PEP639: Support `License-File` metadata
LecrisUT opened this issue · comments
I've just noticed in #702, the License-File
test was removed, and in recent packages, that metadata line is no longer in METADATA
. Was the draft rejected, or what happened there?
No version of METADATA (up to and including 2.3) has License-File: https://packaging.python.org/en/latest/specifications/core-metadata/
I hadn't realized I was adding something that's only in a draft PEP and not part of METADATA 2.1-2.3.
(If this does get standardized, it will become METADATA 2.4, and the License field will be deprecated - it also provides a way for the user to specify the values of these fields in pyproject.toml, which pyproject-metadata doesn't support yet (since it's a draft PEP). I don't think we were putting the correct paths in these fields anyway.)
FYI, it took something like 2 years for METADATA 2.3 to be supported, and it's just barely supported now. So we probably have some time once it gets accepted, if it ever does. ;)
Is there a breakage on pyproject-metadata
to have fields that are not yet defined?
You certainly can't define license
as a string. Also to compute/normalize an SPDX license expression you either need a heavy third party dependency, or introduce potentially unsafe eval's, from what I recently read on the pypa discord server (#hatch
channel).
For now I've renamed the issue to track it. So basically the PEP is meant to add SPDX syntax in License-Expression
+ License-File
and deprecate the older formats. We hope it will be adopted soon, would help keep Fedora metadata in sync since it is already migrating to SPDX.
Are setuptools
and hatchling
fully adopting PEP639, or only License-File
?
Currently the canonical license specifiers are in the trove classifiers - you can get the SPDX license expression from that (https://peps.python.org/pep-0639/appendix-mapping-classifiers/#spec-mapping-classifiers-identifiers). I believe both setuptools and hatchling fully adopt PEP 639 (minus calling the METADATA 2.4), and meson-python, pdm-backend, and scikit-build-core do not (since pyproject-metadata does not). Flit-core does not.
It looks like the next major revision is nearly ready: python/peps#3743
I'm not completely against adding the auto-License-Files that we were adding, but I'm pretty sure they were the wrong paths and would need to be correctly specified and tested.
Correction: setuptools adopts an earlier version of the draft.
I'm not completely against adding the auto-License-Files that we were adding
We are ok with holding it off, since right now only spglib
and python-llama-cpp-python
is being packaged on Fedora. Since there seems to be renewed activity on the PEP we can follow and see how it evolves. 🤞 that it can get finalized.
but I'm pretty sure they were the wrong paths and would need to be correctly specified and tested.
You probably mean LICENSE
vs licenses/LICENSE
? hatchling
is still adopting the former, and that is what Fedora seems to be assuming. It seems the new PEP draft also clarifies it to be the former as well if I read it correctly.