I have developers that want to be able to publish a library as a "beta" or "release" version.
i.e.:
1.2.3-beta
1.2.3
On the consuming project, they couldn't give me any specific criteria of when they would want to use a beta
or release
package. We have CI in place, but without any definitive "when" I can't support two separate pip feeds, as they may flip flop. So I've suggested taking advantage of version range syntax in the requirements file, so they can just specify during checkin what they want. They've never had to do anything like this, and I'm basically a python rookie. Is it possible to filter on pre-release labels? I.e.
Will lib == 1.*.*-*
pick up a beta
package?
and
Will lib == 1.*.*, !=1.*.*-*
pick up a release
package and be sure to exclude any beta
packages?
I would try out my theory myself, but I don't know python well enough to mock up some sort of sample libs locally, and they're too busy to research it.
By default pip
will not install prereleases, like 1.0.0.b1
To enable installation of prereleases, you use the --pre
flag with pip
.
You can also use prerelease version specifiers to force pip
to consider prereleases for individual packages without needing to use --pre
. From https://pip.pypa.io/en/stable/reference/pip_install/#pre-release-versions:
If a Requirement specifier includes a pre-release or development version (e.g.
>=0.0.dev0
) then pip will allow pre-release and development versions for that requirement.
So in your requirements.txt
file, you'd have something like:
package_a>=1.2.3 # will not install pre-releases
package_b>=1.2.3.dev0 # will install pre-releaes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With