pypa / twine

Utilities for interacting with PyPI

Home Page:https://twine.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

check: Error message No METADATA in archive when it's there

jaraco opened this issue · comments

Is there an existing issue for this?

  • 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?

No Metadata in archive

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?

3.12.3

How did you install twine? Did you use your operating system's package manager or pip or something else?

pipx install twine

What version of twine do you have installed (include the complete output)

5.0.0

Which package repository are you using?

pypi.org

Please describe the issue that you are experiencing

When running twine check on the attached wheel, it reports No METADATA in archive, even though it does have a METADATA file. Probably the issue is that the METADATA file is missing the requisite Metadata-Version field.

coherent_build-0.0.1.dev0-py3-none-any.whl.zip

Better would be to report an error message that indicates the true cause of the problem.

Please list the steps required to reproduce this behaviour

Build an invalid wheel without minimal metadata. Run twine check on it.

Anything else you'd like to mention?

No response

pkginfo has the same issue.

This needs to be fixed in pkginfo. I don't believe we can fix it ourselves

The logic also exists in twine:

twine/twine/wheel.py

Lines 76 to 85 in 5d17a43

try:
for path in self.find_candidate_metadata_files(names):
candidate = "/".join(path)
data = read_file(candidate)
if b"Metadata-Version" in data:
return data
finally:
archive.close()
raise exceptions.InvalidDistribution("No METADATA in archive: %s" % fqn)