Add support for PEP 639 change from 'License' to 'License-Expression' in importlib.metadata#234
Closed
bskinn wants to merge 2 commits into
Closed
Add support for PEP 639 change from 'License' to 'License-Expression' in importlib.metadata#234bskinn wants to merge 2 commits into
bskinn wants to merge 2 commits into
Conversation
Appears to be an interface change in importlib.metadata. Appears to be PEP 639, in fact.
reactive-firewall
self-requested a review
October 9, 2025 04:27
reactive-firewall
added a commit
that referenced
this pull request
Oct 13, 2025
…into patch-partial-matching-refactor-231 * includes and supersedes #216 * includes and supersedes #217 * includes and supersedes #224 * supersedes #234 * patch-2: Replaced element check logic with built in set.discard method Fixed: KeyError caused due to the same element getting removed from a set twice * fix-keyerror: Fix KeyError on double deletion * update-requirements: Update pinned requirements again Add changelog entry Fix KeyError if license matches multiple allow-only licenses Fix test case Update pinned dev requirements * Closes GHI #231 (and related issues with modifing sets within loops) * Improved related testing slightly with extra test-cases Resolves Conflicts in: piplicenses.py Co-authored-by: Marc Mueller <cdce8p@users.noreply.github.com> Co-authored-by: Anmol Deep <anmol-aidora@users.noreply.github.com> Co-authored-by: Florian Wünsche <flontis@users.noreply.github.com>
1 task
Collaborator
|
Closing as Superseded by PR #238 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EDIT: Just scanned the PR list, like I should have before putting this together. This PR is an alternative to #213; it seems like this smaller fix may be sufficient? According to the metadata spec,
LicenseandLicense-Expressionare mutually exclusive, andLicense-Expressionis expressly declared as the replacement forLicense, so it should never be necessary to handle package metadata where both fields appear.PEP 639 made some changes to the packaging metadata standard, including deprecating
Licensein favor ofLicense-Expression. This has led topip-licensesfailing to locate various packages' licenses for releases after those packages' build systems rolled over onto PEP 639-compliant tooling.This PR adds a second
lambdato the lookup for the"license"metadata key, pulling the"license-expression"metadata entry, so that metadata with either key/field can be properly processed.Given that
License-Expressionis now the standard andLicenseis deprecated, there might be semantic reasons to put the check for"license-expression"first; I figure that's your call.Example environment:
Before the fix (my arrows added):
After the fix:
The test suite had some failing tests on
masterbranch immediately after clone:After the change of this PR, the test results and coverage are unchanged:
The line numbers of the coverage misses are offset due to the lines I added in the PR.