pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.62k stars 309 forks source link

Twine fails to upload packages with latest metadata-version #1146

Open jaraco opened 2 months ago

jaraco commented 2 months ago

Is there an existing issue for this?

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" <jaraco@jaraco.com>
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

  1. git clone https://github.com/coherent-oss/coherent.deps; cd coherent.deps
  2. pipx run coherent.cli build
  3. pipx run twine upload dist/*

Anything else you'd like to mention?

No response

jaraco commented 2 months ago

Relevant is this comment about supporting pkg_info>=1.11, which seems to address this issue.

jaraco commented 2 months ago

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.