简体   繁体   中英

Private PyPI containing package with same name

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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