Skip to content
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

How to set metadata version #1856

Open
rblin081 opened this issue Dec 16, 2024 · 4 comments
Open

How to set metadata version #1856

rblin081 opened this issue Dec 16, 2024 · 4 comments

Comments

@rblin081
Copy link

https://github.com/pypa/hatch/releases/tag/hatchling-v1.27.0 updated the default version of core metadata to version 2.4

Reading through the hatch documentation I'm not seeing a way to set the version to another value. Unfortunately core metadata version 2.4 is not working with twine and artifacts are unable to be published.
pypa/twine#1178

@ofek
Copy link
Collaborator

ofek commented Dec 16, 2024

https://hatch.pypa.io/latest/plugins/builder/wheel/#options

What do you mean by not working, exactly?

@yaroslaff
Copy link

I am not a topicstarter, but probably I have same issue. My project is SQL grep and you can see full pyproject.toml in repo. In [project] section I have: license = { file = "LICENSE" }.

When I do: hatch build it makes packages with metadata file version 2.3:

Metadata-Version: 2.3
Name: sqlgrep
Version: 0.0.14
Summary: Find string anywhere in database
Project-URL: Homepage, https://github.com/yaroslaff/sqlgrep
Project-URL: Issues, https://github.com/yaroslaff/sqlgrep/issues
Author-email: Yaroslav Polyakov <[email protected]>
License: MIT License
....
License-File: LICENSE
...

(same Metadata-Version: 2.3 both for .whl and .tar.gz packages)

Publishing such files to pypi do not work:

(.venv) mir ~/repo/sqlgrep $ hatch publish
dist/sqlgrep-0.0.14.tar.gz ... failed
Error uploading to repository: https://upload.pypi.org/legacy/ - Client error '400 license-file introduced in metadata version 2.4, not 2.3. See https://packaging.python.org/specifications/core-metadata for more information.' for url 'https://upload.pypi.org/legacy/'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

Seems pypi do not like combination of License-File and Metadata-Version: 2.3

My installed hatch* packages are:

$ pip freeze| grep hatch
hatch==1.14.0
hatchling==1.27.0

Hatchling 1.27.0 should support metadata 2.4, but it makes metadata 2.3

@ofek
Copy link
Collaborator

ofek commented Dec 17, 2024

Try upgrading the required version of Hatchling in the build system table. It's probably using a cached version.

@yaroslaff
Copy link

Cannot tell for topicstarted, but thank you for your advice, it's working for me now! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants