Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Version normalization making an unexpected change #4239

Open
CamDavidsonPilon opened this issue Feb 26, 2024 · 4 comments
Open

[BUG] Version normalization making an unexpected change #4239

CamDavidsonPilon opened this issue Feb 26, 2024 · 4 comments

Comments

@CamDavidsonPilon
Copy link

CamDavidsonPilon commented Feb 26, 2024

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'
@CamDavidsonPilon CamDavidsonPilon added bug Needs Triage Issues that need to be evaluated for severity and status. labels Feb 26, 2024
@abravalheri
Copy link
Contributor

abravalheri commented Feb 26, 2024

I guess what is happening is:

  • in your local machine pip is 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, pip is 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:

  1. Install the latest version of setuptools and wheel + any other build dependencies, and
  2. Run pip install with the --no-build-isolation flag.

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?

@abravalheri
Copy link
Contributor

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

@CamDavidsonPilon
Copy link
Author

Thank you @abravalheri I will try that.

I am supposing that here you mean ...rc0 instead of ...r0

Ah yes, I did mean rc0.

@abravalheri
Copy link
Contributor

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.

@abravalheri abravalheri added Waiting User Feedback and removed bug Needs Triage Issues that need to be evaluated for severity and status. labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants