简体   繁体   English

pip 甚至在名称冲突时从私有索引中选择包而不是 PyPi?

[英]pip to chose packages from a private index over PyPi even on name conflicts?

I have set up a devpi server to host my own Python modules.我已经设置了一个devpi服务器来托管我自己的 Python 模块。 I would like to use pip to install them and for pip to install in preference my modules, not those in PyPi .我想使用 pip 安装它们,并使用 pip优先安装我的模块,而不是 PyPi 中的模块

So far, I have this:到目前为止,我有这个:

[global]
timeout = 60
index-url = http://devpi.example.org/root/public/+simple/
trusted-host = devpi.example.org
extra-index-url = http://devpi.example.org/root/pypi/+simple/

Which works fine as long as there is no name conflict.只要没有名称冲突,它就可以正常工作。 If there is, the highest version wins which is not what I want.如果有,最高版本获胜,这不是我想要的。

I really do not wish to register empty projects on PyPi just to have the names reserved.我真的不想在 PyPi 上注册空项目只是为了保留名称。

Is there any way to get what I want?有什么办法可以得到我想要的吗?

Modified my ~/.config/pip/pip.conf like so:像这样修改我的~/.config/pip/pip.conf

[global]
timeout = 60
trusted-host = devpi.example.org
index-url = http://devpi.example.org/root/public/+simple/

and made sure that the /root/public inherited from /root/pypi like so:并确保/root/public/root/pypi继承,如下所示:

devpi use http://devpi.example.org/
devpi use http://devpi.example.org/root/public --set-cfg
devpi login root --password="MyS3kre7Pwd"
devpi index /root/public bases=root/pypi  # ← vital command.

Running:跑步:

devpi list mead --all   

gives me what I wanted :给我我想要的

http://devpi.example.org/root/public/+f/d12/59ed3e5cf01ca/mead-0.4.0.dev1.tar.gz
http://devpi.example.org/root/public/+f/046/0f3dee895eb46/mead-0.4.0.dev0.tar.gz
http://devpi.example.org/root/pypi/+f/978/98e728d01b4d3/mead-0.0.11.tar.gz    
http://devpi.example.org/root/pypi/+f/45d/b104905aeabc2/mead-0.0.10.tar.gz    
http://devpi.example.org/root/pypi/+f/da0/c1b3bf979ca6a/mead-0.0.9.tar.gz     
http://devpi.example.org/root/pypi/+f/49c/770889ecd3c7a/mead-0.0.8.tar.gz     
http://devpi.example.org/root/pypi/+f/12d/10190b47367e8/mead-0.0.7.tar.gz     
http://devpi.example.org/root/pypi/+f/34a/6dd6cd6c52c67/mead-0.0.6.tar.gz     
http://devpi.example.org/root/pypi/+f/ba8/0cd76854e2253/mead-0.0.5.tar.gz     
http://devpi.example.org/root/pypi/+f/1d7/6c5dd5229333b/mead-0.0.4.tar.gz     
http://devpi.example.org/root/pypi/+f/47d/208d9cba5ea4e/mead-0.0.3.tar.gz     
http://devpi.example.org/root/pypi/+f/20a/e16978e840e38/mead-0.0.2.tar.gz  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM