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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

befeleme
Copy link

@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.

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
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.

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?
3 participants