-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Making project-url as Dynamic causes PyPI to block the wheel starting from 75.8.0 #4801
Comments
Thank you @justinchuby
Could you please confirm you are using the |
I see... @justinchuby, could you please add the generated |
I tried to create a minimal reproducer (one that does not need to go to all the code in mkdir -p /tmp/test-onnxscript
cd /tmp/test-onnxscript
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/pyproject.toml
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/README.md
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/MANIFEST.in
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/LICENSE
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/VERSION
wget https://github.com/microsoft/onnxscript/raw/refs/heads/main/setup.py
mkdir onnxscript
touch onnxscript/__init__.py
sed -i 's/"setuptools>=.*"/"setuptools>=75.8.0"/' pyproject.toml
python3.12 -m venv .venv
.venv/bin/python -m pip install -U pip build packaging
.venv/bin/python -m build
unzip dist/onnxscript-0.1.0.dev20250114-py3-none-any.whl onnxscript-0.1.0.dev20250114.dist-info/METADATA
# bat -A onnxscript-0.1.0.dev20250114.dist-info/METADATA # Looks Ok
.venv/bin/python - <<EOF
from packaging.metadata import Metadata, parse_email
# Validate generated files using 'packaging' for benchmark
for example in ("onnxscript.egg-info/PKG-INFO", "onnxscript-0.1.0.dev20250114.dist-info/METADATA"):
with open(example, "rb") as f:
raw, unparsed = parse_email(f.read())
print("\n", example)
print("Unparsed, should be empty:", repr(unparsed)) # seems fine
raw.pop("license_files", None) # See on-going https://github.com/pypa/setuptools/issues/4759
print("Should have no exceptions:", Metadata.from_raw(raw, validate=True)) # seems fine, no exceptions
EOF I cannot detect why the file is being malformed and why the parser in PyPI thinks that @justinchuby could you please share the |
This is the file generated, the only change I saw when diffing is the metadata version and the dynamic: line (line 52) https://gist.github.com/justinchuby/cdf2588573fdde2729cd37a55fcd6f1b I can attach the original file later |
I think so. It can be seen in https://github.com/microsoft/onnxscript/blob/347aa066181af888f649fea963d6ab2c3c9044f4/setup.py#L34 |
I see what you are saying now... The error message seems to suggest that the |
METADATA.zip file from the wheel if it's different |
I copied the 2 files you provided and tested again in my little benchmark script: .venv/bin/python - <<EOF
from packaging.metadata import Metadata, parse_email
# Validate generated files using 'packaging' for benchmark
for example in ("METADATA", "PKG-INFO.txt"):
with open(example, "rb") as f:
raw, unparsed = parse_email(f.read())
print("\n", example)
print("Unparsed, should be empty:", repr(unparsed)) # seems fine
raw.pop("license_files", None) # See on-going https://github.com/pypa/setuptools/issues/4759
print("Should have no exceptions:", Metadata.from_raw(raw, validate=True)) # seems fine, no exceptions
EOF Both seem to be fine: METADATA
Unparsed, should be empty: {}
Should have no exceptions: <packaging.metadata.Metadata object at 0x7f444342a180>
PKG-INFO.txt
Unparsed, should be empty: {}
Should have no exceptions: <packaging.metadata.Metadata object at 0x7f44433c7a10> When I see the files with Any chance there was a problem during parsing and/or a the file was corrupted during the upload? |
Thanks for checking the file @abravalheri ! I will go back and do some more checks |
It looks like another internal issue we need to resolve. Sorry for the false signal, and thanks again for your help! |
Sorry I have to reopen. After resolving internal issues, we continue to see this error when release to PyPI. |
Hi @justinchuby, to continue investigating the issue we need a minimal reproducer that does not depend on PyPI. Can this error be verified in an isolated state prior to be uploaded? This eliminates potential errors with corrupted uploads or specific parsers employed by external systems that can themselves contain bugs sometimes. Ideally we want to be able to verify a malformed |
setuptools version
setuptools==75.8.0
Python version
Python 3.13
OS
Linux
Additional environment information
No response
Description
After upgrading to
setuptools==75.8.0
in https://github.com/microsoft/onnxscript, the PKD-INFO generated became Metadata-Version: 2.2, with a new lineDynamic: project-url
added to the metadata file. This causes PyPI to reject the wheel with messageExpected behavior
I would expect the wheel to be valid for PyPI even when the project url is dynamic. The URLs field needs to be dynamic for us because we want to generate an url based on the git commit.
How to Reproduce
git clone https://github.com/microsoft/onnxscript.git
python -m build
Output
N/A
The text was updated successfully, but these errors were encountered: