← All tasks
pythonpypa/setuptools #4483Reported task

[BUG] TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'

envgap__pypa__setuptools-4483

01 / FAILURE SIGNATURE

Captured in a clean container

TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'

02 / ENVIRONMENT RECIPE

Base commit
f2a6bb190202577595a45ceebdedb0016b7cf864
Manifest
pyproject.toml
Reproduce
python3 setup.py egg_info
Run under trace
python3 -c 'from setuptools._core_metadata import _distribution_fullname; assert _distribution_fullname('"'"'demo'"'"','"'"'1.0.0'"'"')=='"'"'demo-1.0.0'"'"'; print(_distribution_fullname('"'"'demo'"'"','"'"'1.0.0'"'"'))'
Reference environment fix used for admission
diff --git a/pyproject.toml b/pyproject.toml
index b3399570b..5fa285dd6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,6 +25,7 @@ classifiers = [
 keywords = ["CPAN PyPI distutils eggs package management"]
 requires-python = ">=3.8"
 dependencies = [
+    "packaging==24.1",
 ]
 
 [project.urls]
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+set -euo pipefail
+python3 -m pip install packaging==24.1

03 / ORIGINAL ISSUE TEXT

pypa/setuptools #4483 · read the original issue
### setuptools version

setuptools>=71.0.0

### Python version

Python 3.12

### OS

Ubuntu

### Additional environment information

I found this bug when running the test for the project in GitHub actions

### Description

When I install the requirements in my Python package project (`pip-sync requirements-dev.txt`) I get an error within setuptools which says:

```

Preparing metadata (setup.py) ... error

error: subprocess-exited-with-error



× python setup.py egg_info did not run successfully.

...

TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'

```

This error was caused by using setuptools >= 71.0.0



Not to speculate but it looks like the issue was introduced by this commit in setuptools: https://github.com/pypa/setuptools/commit/00384a5f4fd22c653172b99feefe13b0009eb870



And this commit is including new changes from the packaging project and its this commit here where we can see the issue:

https://github.com/pypa/packaging/commit/cc938f984bbbe43c5734b9656c9837ab3a28191f

https://github.com/pypa/packaging/blame/4493dfcd95a893f676a7aa4bd17c547bea676371/src/packaging/utils.py#L58





### Expected behavior

I would expect `pip-sync requirements-dev.txt` to run successfully

### How to Reproduce

Clone https://github.com/tim-s-ccs/example-python-package.git

Make sure you are using Python 3.12 and you have pip-tools installed (`pip install --upgrade pip wheel pip-tools`)

Make sure you are using the correct version of setuptools `pip install --upgrade setuptools==71.0.0`

Run `pip-compile requirements-dev.in`

### Output

```console

    error: subprocess-exited-with-error

    

    × python setup.py egg_info did not run successfully.

    │ exit code: 1

    ╰─> [42 lines of output]

        running egg_info

        creating /private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info

        writing /private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info/PKG-INFO

        writing dependency_links to /private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info/dependency_links.txt

        writing top-level names to /private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info/top_level.txt

        writing manifest file '/private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info/SOURCES.txt'

        reading manifest file '/private/var/folders/kt/n16_msf56_z3kfyb65l37wxhb_m4s_/T/pip-pip-egg-info-3sca_19y/example_python_package.egg-info/SOURCES.txt'

        Traceback (most recent call last):

          File "<string>", line 2, in <module>

          File "<pip-setuptools-caller>", line 34, in <module>

          File "/Users/my.name/Code/test/example-python-package/setup.py", line 16, in <module>

            setup(

  
Continue on GitHub ↗

04 / LABELS

Labels checked by running the task · assistant reviewed

No supported category has been assigned.

Label rules and the text that matched
[]

Historical install-only results are not EnvGap validation.

The issue reproducer reported Python3.12, while the official image is Python3.10; the same packaging canonicalize_version keyword incompatibility is required in captured stderr.

The old packaging version is an explicit baseline context, not a hidden gold-only alteration. Setup installs the fixed declaration before the backend must generate its own metadata.

Runtime calls the exact affected setuptools metadata-name function and asserts preservation of trailing zero version components.

Preparation uses current registries. Historical package availability is not enforced here; execution metadata records this limitation separately from the oracle's date-bounding policy.