PyPi registry: no support for ".post" versions (PEP 440)

im using the PyPi package registry.
I managed to setup everything (twine upload, pip install with tokens, install from group level, etc), and all the flow is working fine inside a gitlab pipeline. So far so good.

However, it seems that “.post” releases are ignored by gitlab: you cannot install those.

I have my master branch tagged with version 1.2.3, and package built and uploaded to the registry.
Then in my develop branch I add some code and save some new commits. The local git describe output is something like: 1.2.3-4-dhdfjh where the “4” is the number of new commits after the 1.2.3 version.
Now i build a development release of my package.

I cannot build a package setting the version to 1.2.3.dev4 since it is considered by pypi LESSER than 1.2.3 (PEP 440): in fact if I run pip install i get the 1.2.3 (clean) version (if I delete the 1.2.3 version from the registry i correctly get the 1.2.3.dev4 version).

Proof of this:

from pkg_resources import parse_version as pv
pv(‘1.2.3’) > pv(‘1.2.3.dev4’)

So i must set the version using the post segment, following PEP 440 specifications:

from pkg_resources import parse_version as pv
pv(‘1.2.3’) < pv(‘1.2.3.post0.dev4’)

But the version with post in it is always ignored by gitlab’s pypi, and i got proof of this trying to install the package using the version in the command line.
For instance, using the command line:

pip install -v 5.11.0.post0.dev13 my-package (…)
i get
ERROR: Could not find a version that satisfies the requirement 5.11.0.post0.dev13 (from versions: none)
ERROR: No matching distribution found for 5.11.0.post0.dev13

and the package has been correctly uploaded to the registry, and i can see it from the gitlab’s UI .

For now my unique alternative is to always build a “clean” releases before, and pin the versions in the requirements file. But this makes the development process slower.

Has anyone experienced similar issues and maybe has any suggestions for me please? Or do you think should I think to open a feature request to ask support for “post” releases?

EDIT: other alternative which comes now in my mind, is to increment the patch number of the version and just use the ‘.dev’ suffix, so:


this should work either


New findings. It seems that pip installs just the latest clean version, if present at least one.

I tried to solve the issue with the trick of incrementing the version by 1, but i still get the package marked with the last clean version (so also the ones with the .dev suffix are ignored). Probably pypi returns the .dev packages only if there are no packages with a clean versions (my guess is that it returns the latest stable version if present).
It’s possible to install a dev package with the syntax ==X.Y.Z.devK but it’s not something useful to me (i needed the .devK package to be installed using the <X syntax to be able to automatize it).

So, my unique option left is to build just clean versions.

Any other insight is however welcome.