2

In a private pip repository there is a package called 'test_package'.

The package has a QA and a prod version that is differentiated by v.v.v.prod and v.v.v.qa where v is the major, minor, and micro.

How would I get the package with the latest version for qa or prod? To give context, there is a docker job that is pulling the latest package each time it runs and it needs to pull qa or prod.

Would a better way to do this possibly be to have two packages 'test_package_qa' and 'test_package_prod'? Is there a way to copy a package and rename it to another package through pip commands if this is a better way to go? (e.g. test_package_qa-1.0.1 and copy it to test_package_prod-1.0.0 where test_package_qa latest could be on version 1.1.0, but 1.0.1 is the one we want to release to prod)

echen
  • 75
  • 1
  • 10

1 Answers1

0

Following the naming conventions explained here you should use a versioning schema that uses v.v.v for production and v.v.v.devN for pre-release/development versions, e.g. 1.0.0 and 1.0.1.dev0.

pip will then only install the lastest production version unless you use the --pre parameter or try to explicitly install this version.

I verified this by settup up a local repository, my package is called foobar-utils. In the repository there are 3 versions:

foobar_utils-0.1.0.dev1
foobar_utils-0.1.0
foobar_utils-0.1.1.dev1

pip install commands:

# install latest production version
$ pip install foobar-utils
... Downloading foobar_utils-0.1.0-py2.py3-none-any.whl ...

# install latest pre-release
$ pip install --pre foobar-utils
... Downloading foobar_utils-0.1.1.dev1-py2.py3-none-any.whl ...

# install a pre-release by specifying version
$ pip install "foobar-utils>=0.1.1.dev1"
... Downloading foobar_utils-0.1.1.dev1-py2.py3-none-any.whl ...
Community
  • 1
  • 1
chrki
  • 6,143
  • 6
  • 35
  • 55