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

feat: adding PEP 639 support #132

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Sep 11, 2024

This adds PEP 639 support. Details for backends mentioned in readme.

I left normalization and validation to packaging (pypa/packaging#828), otherwise we'd want to basically vendor that code and keep a license list up to date.

  • Need to add tests for the various error and warning conditions.
  • And I forgot the classifier error and warning bit.

Close #130.

Copy link
Contributor

@dnicolodi dnicolodi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @henryiii for working on this. I haven't read the final version of the PEP, thus I cannot comment on whether this implements it correctly, however, I gave a quick look and I have a few comments on the implementation.

The most important one is that I think the validation of the license-related fields happens at the wrong time. The other are just minor things, mostly improvements to the exception messages.

pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
pyproject_metadata/__init__.py Outdated Show resolved Hide resolved
@dnicolodi
Copy link
Contributor

I scrolled through PEP639 and I've noticed a couple more things: this PR does not implement support for custom licenses (the LicenseRef-[idstring] metadata fields) and the validation of the glob patters is not as strict as specified in the PEP.

@henryiii
Copy link
Collaborator Author

This PR doesn't do any validation of the license string at all, so LicenseRef-[idstring] should be fine? I'd assume the packaging PR would handle those?

@dnicolodi
Copy link
Contributor

This PR doesn't do any validation of the license string at all, so LicenseRef-[idstring] should be fine? I'd assume the packaging PR would handle those?

I think I misread the PEP. I thought that custom licenses went in a different RFC822 field. It does not seem the case.

@henryiii
Copy link
Collaborator Author

Could I get a quick set of eyes on #133 and #134? I'll rebase this once those are in.

@dnicolodi
Copy link
Contributor

Sorry, continuing my quest for better error messages...

@henryiii henryiii force-pushed the henryiii/feat/pep639 branch 2 times, most recently from a269c67 to 3a76850 Compare September 11, 2024 17:03
@dnicolodi
Copy link
Contributor

Thanks @henryiii Everything looks good to me.

I can have a try at integrating this into meson-python and see how it goes (we need to make sure that the license files are included in the wheel, otherwise I don't see anything else that needs to be done in the build backend) and report back. Or you can merge it and we can fix any shortcoming later. I'll probably will not have much time to work on this in the next couple of days...

@henryiii
Copy link
Collaborator Author

There will be one more set of warnings or errors (if License :: is present), and a few more tests.

Will ping both you and Frost when it's ready.

@henryiii henryiii marked this pull request as ready for review September 11, 2024 19:46
@henryiii
Copy link
Collaborator Author

@frostming and @dnicolodi, this is ready for review (@dnicolodi, the only thing changed since you've looked last is more tests and some new License related warnings and an error. And I followed your suggestion of putting the warning in validate, added a param to turn the warnings off so they only show up once).

@henryiii henryiii force-pushed the henryiii/feat/pep639 branch 3 times, most recently from 7c258dc to 585e567 Compare September 13, 2024 03:49
Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Daniele Nicolodi <[email protected]>

fix: also error if classfiers are also given

Signed-off-by: Henry Schreiner <[email protected]>

tests: add more tests

Signed-off-by: Henry Schreiner <[email protected]>

fix: one more warning

Signed-off-by: Henry Schreiner <[email protected]>

fix: address review comments

Signed-off-by: Henry Schreiner <[email protected]>

fix: include string in the error message for project.license

Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii merged commit ef598c3 into pypa:main Sep 13, 2024
22 checks passed
@henryiii henryiii deleted the henryiii/feat/pep639 branch September 13, 2024 03:59
@henryiii
Copy link
Collaborator Author

henryiii commented Sep 13, 2024

I've released 0.9.0b1 so backend authors can try these changes out before we release them fully.

@dnicolodi for meson-python
@frostming for pdm-backend
@henryiii for scikit-build-core
@pradyunsg for sphinx_theme_builder

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 this pull request may close these issues.

PEP 639
2 participants