简体   繁体   English

包含同名包的私有PyPI

[英]Private PyPI containing package with same name

I am setting up my own PyPI containing some private packages. 我正在设置包含一些私有软件包的我自己的PyPI。 The problem is that some of the private packages have the same name as existing packages in PyPI. 问题在于某些私有软件包与PyPI中的现有软件包具有相同的名称。

The private packages with same name do not necessarily have higher version number than the existing packages in PyPI, therefore when I do pip install --extra-index-url <Private_PyPI_URL> , pip will automatically download the packages with higher version number which may not be the one from my private repository. 具有相同名称的私有软件包不一定具有比PyPI中现有软件包更高的版本号,因此,当我进行pip install --extra-index-url <Private_PyPI_URL> ,pip将自动下载具有更高版本号的软件包成为我的私人存储库中的那个。

How can I make pip install check PyPI for packages only if it fails to find the package from the private repository? 仅当无法从私有存储库中找到软件包时,如何使pip install检查PyPI软件包?

Note also that the private packages can sometimes be specified as the dependencies of other private packages as well. 还要注意,有时也可以将私有软件包指定为其他私有软件包的依赖项。

Use a --find-links direct link to the index page listing those packages: 使用--find-links直接链接到列出这些软件包的索引页面:

pip install --find-links <Private_PyPI_URL>/package_name package_name

but you really want to use an internal version number (append _companyname_1 , etc.) and pin to those version numbers. 但您确实要使用内部版本号(附加_companyname_1等)并固定到这些版本号。 See Specifying Your Project's Version in the Packaging Guide. 请参阅包装指南中的指定项目的版本

That way you can still switch between your version and the publicly released version simply by switching version numbers . 这样,您仍然可以简单地通过切换版本号在版本和公开发布的版本之间切换

Another thing you want to do is use a proper pip requirements file to pin version numbers, and version-control that file. 您要做的另一件事是使用适当的点子要求文件来固定版本号,并对该文件进行版本控制。 You can include indexes and find-links urls in that file too. 您也可以在该文件中包含索引和查找链接URL。

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

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