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

Implement PEP 639 #16620

Closed
befeleme opened this issue Sep 3, 2024 · 9 comments · Fixed by #16949
Closed

Implement PEP 639 #16620

befeleme opened this issue Sep 3, 2024 · 9 comments · Fixed by #16949

Comments

@befeleme
Copy link

befeleme commented Sep 3, 2024

What's the problem this feature will solve?
Standardized licensing metadata will in time unify the currently largely chaotic landscape.

Describe the solution you'd like
See: https://peps.python.org/pep-0639
PEP 639 has been provisionally accepted with one of the conditions being implementation in PyPI.

@befeleme befeleme added feature request requires triaging maintainers need to do initial inspection of issue labels Sep 3, 2024
@ewdurbin
Copy link
Member

ewdurbin commented Sep 3, 2024

PyPI uses https://github.com/pypa/packaging to parse and validate metadata, so it will need an update to support the new metadata version, keys, and deprecations.

I've opened draft PRs for that and the packaging docs at:

Once those PRs (or something that supersedes them) are merged, implementation in PyPI can begin.

@ewdurbin
Copy link
Member

Draft PR is now up at #16949 awaiting merge/release of pypa/packaging#828.

@ewdurbin
Copy link
Member

ewdurbin commented Nov 8, 2024

#16949 is now ready for review with the release of packaging 24.2

@ewdurbin
Copy link
Member

PEP 639 implementation is live and online for PyPI now. We'll keep an eye out for issues filed if folks run into any issues as adoption takes off.

@di
Copy link
Member

di commented Dec 18, 2024

Reopening this because part of implementing PEP 639 is also deprecating the Licence metadata field and the various License :: trove classifiers. We should define a deprecation period, during which we warn users, and a suitable threshold for dropping support for these fields.

@ewdurbin
Copy link
Member

By my read of 639, PyPI's responsibility is to not add any new license classifiers...

New license classifiers MUST NOT be added to PyPI; users needing them SHOULD use the License-Expression field instead. License classifiers may be removed from a new version of the specification in a future PEP.

I think deprecating them in the way proposed in pypa/trove-classifiers#199 is left to a future pep.

@ewdurbin
Copy link
Member

I'm also pretty certain we are already meeting the spec for the License field:

For all newly-uploaded distribution archives that include a License-Expression field, the Python Package Index (PyPI) MUST reject any that specify both License and License-Expression fields.

The License field may be removed from a new version of the specification in a future PEP.

# Ensure that License and License-Expression are mutually exclusive
# See https://peps.python.org/pep-0639/#deprecate-license-field
if metadata.license and metadata.license_expression:
errors.append(
InvalidMetadata(
"license",
(
"License is deprecated when License-Expression is present. "
"Only License-Expression should be present."
),
)
)

@ewdurbin
Copy link
Member

I don't think there is further work to be done here without additional PEPs to remove license classifiers or remove the license field.

@di
Copy link
Member

di commented Dec 18, 2024

Reading https://peps.python.org/pep-0639/#backwards-compatibility more closely, I agree:

The legacy deprecated Core Metadata License field, license key table subkeys (text and file) in the pyproject.toml [project] table and license classifiers retain backwards compatibility. A removal is left to a future PEP and a new version of the Core Metadata specification.

@di di closed this as completed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants