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

Show License-Expression if present in package metadata #13145

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

befeleme
Copy link
Contributor

@befeleme befeleme commented Jan 7, 2025

With Core Metadata 2.4 a new field, License-Expression, has been added. If it's present, favor it over the deprecated (with PEP 639) legacy unstructured License field.

Closes: #13112

@pfmoore
Copy link
Member

pfmoore commented Jan 7, 2025

Could you add a test for the new output? Thanks.

@ichard26
Copy link
Member

ichard26 commented Jan 8, 2025

Also, it looks like CI is failing as the ubuntu-latest worker is now running Ubuntu 24.04 LTS which doesn't ship with subversion. We'll take a look when we can.

@befeleme
Copy link
Contributor Author

befeleme commented Jan 9, 2025

Could you add a test for the new output? Thanks.

I'm trying to, but have a hard time with simulating the data - do I have to create a package with new metadata in order to make pip "install" it and then assert the output? Any pointers will be appreciated.

One more thing is, when pip itself moves to PEP 639 & setuptools supports it, this won't be true anymore:
https://github.com/pypa/pip/blob/main/tests/functional/test_show.py#L229
I may make test future-proof and assert the expected key per the version of metadata and existence of the field.
Or just wait for the moment to happen and then make a single change in the code.

@pfmoore
Copy link
Member

pfmoore commented Jan 9, 2025

I'm trying to, but have a hard time with simulating the data - do I have to create a package with new metadata in order to make pip "install" it and then assert the output? Any pointers will be appreciated.

You might have to - there's some examples in test_show.py which install a pre-built wheel and show it. See test_show_with_files_from_wheel for an example. Alternatively, you could write a unit test that just exercises print_results with artificial inputs - there's no need to get too clever here.

@notatallshaw
Copy link
Member

FYI, CI should be working again, if you merge from main.

With Core Metadata 2.4 a new field, License-Expression, has been added.
If it's present, favor it over the deprecated (with PEP 639) legacy
unstructured License field.

Closes: pypa#13112
@befeleme
Copy link
Contributor Author

Took me a while, but there are two tests added.

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

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

LGTM!

@pfmoore pfmoore merged commit c7fb1e1 into pypa:main Jan 21, 2025
31 checks passed
@pfmoore
Copy link
Member

pfmoore commented Jan 21, 2025

Thanks for the contribution!

@befeleme befeleme deleted the pip-show-pep639 branch January 21, 2025 18:03
@ichard26
Copy link
Member

Thank you indeed. Congratulations on the PEP! 🎉

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

Successfully merging this pull request may close these issues.

pip show displays License metadata field - switch to License-Expression?
4 participants