Twine fails to upload packages with latest metadata-version
Is there an existing issue for this?
- [X] I have searched the existing issues (open and closed), and could not find an existing issue
What keywords did you use to search existing issues?
metadata-version InvalidDistribution
What operating system are you using?
macOS
If you selected 'Other', describe your Operating System here
No response
What version of Python are you running?
Python 3.12.5
How did you install twine? Did you use your operating system's package manager or pip or something else?
pipx reinstall --python 3.12 twine
What version of twine do you have installed (include the complete output)
5.1.1
Which package repository are you using?
pypi.org
Please describe the issue that you are experiencing
This issue is a reprise of https://github.com/pypa/twine/issues/1059. Now that PEP 639 is provisionally accepted, the coherent system has implemented support, and subsequently packages built under that system fail with the error:
coherent.deps main 🐚 twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
ERROR InvalidDistribution: Metadata is missing required fields: Name, Version.
Make sure the distribution includes the files where those fields are specified, and is using a supported Metadata-Version: 1.0, 1.1, 1.2,
2.0, 2.1, 2.2, 2.3.
The error message "missing required fields" appears to be incorrect. The fields are there.
dist main 🐚 unzip -q *.whl; cat *.dist-info/METADATA
Metadata-Version: 2.4
Name: coherent.deps
Version: 0.2.1
Author-Email: "Jason R. Coombs" <[email protected]>
License-Expression: MIT
Summary: Utilities for resolving imports to dependencies.
Requires-Python: >= 3.8
Requires-Dist: tqdm
Requires-Dist: jaraco.ui
Requires-Dist: coherent.deps
Requires-Dist: jaraco.context
Requires-Dist: jaraco.collections
Requires-Dist: jaraco.mongodb
Requires-Dist: keyring
Requires-Dist: tempora
Requires-Dist: jaraco.compat
Requires-Dist: jaraco.functools
Requires-Dist: more-itertools
Requires-Dist: requests
Requires-Dist: requests-file
Requires-Dist: requests-toolbelt
Requires-Dist: retry-requests
Requires-Dist: zipp
Provides-Extra: doc
Provides-Extra: test
Project-URL: Source, https://github.com/coherent-oss/coherent.deps
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
According to the spec tools should warn (but presumably not error) if the version is a minor increment higher than the highest supported.
Please list the steps required to reproduce this behaviour
git clone https://github.com/coherent-oss/coherent.deps; cd coherent.depspipx run coherent.cli buildpipx run twine upload dist/*
Anything else you'd like to mention?
No response
Relevant is this comment about supporting pkg_info>=1.11, which seems to address this issue.
Twine is pinned against pkg_info 1.11, so is hard-blocked against supporting this new metadata version. https://github.com/pypa/twine/pull/1123 proposes to unblock it, but that PR has languished.
this can be closed, twine v6.0.0 was released which includes https://github.com/pypa/twine/pull/1123
I am still having this issue with python3.13. To reproduce, use a python 3.13 and:
git clone [email protected]:ilan-gold/zarrs-python.git- (
uv)pip install "twine>6.0.0" ".[dev]" maturin build --release -o disttwine check --strict dist/*
Full env:
asciitree==0.3.3
certifi==2024.8.30
cfgv==3.4.0
charset-normalizer==3.4.0
crc32c==2.7.1
distlib==0.3.9
docutils==0.21.2
donfig==0.8.1.post1
fasteners==0.19
filelock==3.16.1
fsspec==2024.10.0
identify==2.6.3
idna==3.10
iniconfig==2.0.0
jaraco-classes==3.4.0
jaraco-context==6.0.1
jaraco-functools==4.1.0
keyring==25.5.0
markdown-it-py==3.0.0
maturin==1.7.6
mdurl==0.1.2
more-itertools==10.5.0
msgpack==1.1.0
nh3==0.2.19
nodeenv==1.9.1
numcodecs==0.14.1
numpy==2.1.3
packaging==24.2
pip==24.3.1
pkginfo==1.11.2
platformdirs==4.3.6
pluggy==1.5.0
pre-commit==4.0.1
pygments==2.18.0
pytest==8.3.4
pyyaml==6.0.2
readme-renderer==44.0
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.9.4
twine==6.0.1
typing-extensions==4.12.2
universal-pathlib==0.2.5
urllib3==2.2.3
virtualenv==20.28.0
zarr==3.0.0b2
zarrs @ file:///Users/ilangold/Projects/zarrs-python
zstandard==0.23.0
@ilan-gold You need to update to twine 6.1.0 or later -- 6.0.0 fixed this in some cases, but 6.1.0 provides the fully general fix.