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

License-File core metadata field not emitted #1828

Closed
konstin opened this issue Nov 26, 2024 · 7 comments · Fixed by #1829
Closed

License-File core metadata field not emitted #1828

konstin opened this issue Nov 26, 2024 · 7 comments · Fixed by #1829

Comments

@konstin
Copy link

konstin commented Nov 26, 2024

It seems that hatchling is emitting the License key in metadata for PEP 639 and including the glob-matched files in the correct directory, but it is not emitting the License-File key.

Input:

[project]
name = "test-token"
version = "0.1.0"
license = "MIT OR Apache-2.0"
license-files = ["LICENSE-MIT", "LICENSE-APACHE"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
$ tree
.
├── LICENSE-APACHE
├── LICENSE-MIT
├── pyproject.toml
└── src
    └── test_token
        └── __init__.py

Output:

$ unzip -l dist/test_token-0.1.0-py2.py3-none-any.whl
Archive:  dist/test_token-0.1.0-py2.py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
       63  2020-02-02 00:00   test_token/__init__.py
       81  2020-02-02 00:00   test_token-0.1.0.dist-info/METADATA
      105  2020-02-02 00:00   test_token-0.1.0.dist-info/WHEEL
    11356  2020-02-02 00:00   test_token-0.1.0.dist-info/licenses/LICENSE-APACHE
     1077  2020-02-02 00:00   test_token-0.1.0.dist-info/licenses/LICENSE-MIT
      503  2020-02-02 00:00   test_token-0.1.0.dist-info/RECORD
---------                     -------
    13185                     6 files

METADATA in dist/test_token-0.1.0-py2.py3-none-any.whl:

Metadata-Version: 2.3
Name: test-token
Version: 0.1.0
License: MIT OR Apache-2.0
konstin added a commit to astral-sh/uv that referenced this issue Nov 26, 2024
We were previously not uploading all metadata in the formdata of an upload request in the legacy api. Notably, we were missing the PEP 639 license-files field.

I had to switch to pdm due to pypa/hatch#1828
konstin added a commit to astral-sh/uv that referenced this issue Nov 26, 2024
We were previously not uploading all metadata in the formdata of an upload request in the legacy api. Notably, we were missing the PEP 639 license-files field.

I had to switch to pdm due to pypa/hatch#1828
@ofek
Copy link
Collaborator

ofek commented Nov 26, 2024

That field was introduced in metadata version 2.4 which is not yet the default. You can set the version until that happens, probably in a few days.

@ofek
Copy link
Collaborator

ofek commented Nov 26, 2024

I see that it's so critical for you that you're switching to PDM... so I guess I have to do this today.

@konstin
Copy link
Author

konstin commented Nov 26, 2024

This is our internal test code. The tension here is that it allows me setting license-files in pyproject.toml, includes the files in the correct location, but then does not emit the metadata. My expectation would have been that license-files are rejected/warned about and ignored (pre-PEP 639 behavior), or that it automatically increases the metadata if license-files is used (post-PEP 639 behaviour).

@ofek
Copy link
Collaborator

ofek commented Nov 26, 2024

That would have been breaking everybody because PyPI rejected 2.4 uploads until last week.

@konstin
Copy link
Author

konstin commented Nov 26, 2024

Yeah, in my read using license-files in pyproject.toml was incompatible with publishing to pypi until that change, since PEP 639 connects adding license-files to bumping the metadata version.

@ofek
Copy link
Collaborator

ofek commented Nov 26, 2024

I was going to release for you but it looks like if I change the default everybody will be broken at the moment because the recommended upload action doesn't support 2.4 yet:

@konstin
Copy link
Author

konstin commented Nov 26, 2024

Please don't feel any pressure to make a release for me, i'm fine with the release test script as-is (this does not touch uv in general, this is plumbing to have integration testing for uv publish), i reported this because i thought is was unintentional behavior in hatchling.

konstin added a commit to astral-sh/uv that referenced this issue Nov 26, 2024
We were previously not uploading all metadata in the formdata of an
upload request in the legacy api. Notably, we were missing the PEP 639
license-files field.

I had to switch to pdm due to pypa/hatch#1828
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

Successfully merging a pull request may close this issue.

2 participants