[BUG] Version normalization making an unexpected change
setuptools version
>=40.8.1
Python version
3.11
OS
ubuntu
Additional environment information
Run in the github action
Description
When building a wheel using github actions, my version was normalized from 24.2.25r0 to 24.2.25.post0. I am not able to reproduce this locally, as 24.2.25r0 should be a valid version name. Here is a link the the action logs: https://github.com/Pioreactor/pioreactor/actions/runs/8040467416/job/21958604300#step:5:10
Expected behavior
I expected there to be no change to the version name.
How to Reproduce
I've rerun the github action, and it's giving the same change.
However, locally, no change is introduced:
from setuptools import setuptools
from setuptools import dist
d = dist.Distribution()
d._normalize_version('24.2.25rc0')
Output
'24.2.25rc0'
I guess what is happening is:
- in your local machine
pipis choosing to use a "non-isolated build" so it just uses the version of setuptools that you have installed in the environment (probably an updated one) - in the CI,
pipis choosing to use an "isolated build", and therefore it creates a brand new virtual environment. In this new virtual environment an old version of setuptools is being used.
(Or vice-versa)
To read more about build isolation you can refer to https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#build-isolation.
To consistently disable the "build isolation" feature in pip you can:
- Install the latest version of
setuptoolsandwheel+ any other build dependencies, and - Run
pip installwith the--no-build-isolationflag.
If you try this you should at least see a consistent behaviour between the local machine and CI.
Would you like to give this a try and see how it goes?
I am not able to reproduce this locally, as 24.2.25r0 should be a valid version name.
I am supposing that here you mean ...rc0 instead of ...r0
Thank you @abravalheri I will try that.
I am supposing that here you mean ...rc0 instead of ...r0
Ah yes, I did mean rc0.
Alternatively, to consistently enable build isolation, you can add a pyproject.toml file:
[build-system]
requires = ["setuptools>=69.1.1"]
build-backend = "setuptools.build_meta"
This way, you can specify a minimum version required for the setuptools that will be installed in the "disposable" build environment.
I haven't seen this problem since, so I suspect it was something odd unique to my setup. I feel this issue can be closed.