包含相同名称的私有PyPI包 [英] Private PyPI containing package with same name

查看:107
本文介绍了包含相同名称的私有PyPI包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置包含一些私有软件包的我自己的PyPI.问题在于某些私有软件包与PyPI中的现有软件包具有相同的名称.

具有相同名称的私有软件包不一定具有比PyPI中现有软件包更高的版本号,因此,当我执行pip install --extra-index-url <Private_PyPI_URL>时,pip会自动下载具有更高版本号的软件包,而这可能不是我的私有软件包.存储库.

仅当PyPI无法从私有存储库中找到软件包时,如何使pip install检查软件包的PyPI?

还请注意,有时也可以将私有软件包指定为其他私有软件包的依赖项.

解决方案

使用--find-links直接链接到列出这些软件包的索引页面:

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

但是您真的想要使用内部版本号(附加_companyname_1等)并固定到这些版本号.请参阅《包装指南》中的指定项目的版本. /p>

这样,您仍然可以通过切换版本号来简单地在版本和公开发布的版本之间进行切换.

您要做的另一件事是使用正确的 pip需求文件固定版本号,并对该文件进行版本控制.您也可以在该文件中包含索引和查找链接URL.

I am setting up my own PyPI containing some private packages. The problem is that some of the private packages have the same name as existing packages in 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.

How can I make pip install check PyPI for packages only if it fails to find the package from the private repository?

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:

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. 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.

这篇关于包含相同名称的私有PyPI包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆