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

Enable partial matching on allow-only/fail-on #186

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

costasd
Copy link
Contributor

@costasd costasd commented Mar 26, 2024

This changeset introduces a way to do partial matching on license names.

Say, to match all BSD licenses for a given --fail-on=BSD.

To do so, it:

  • Introduces a new cli boolean parameter (default false), called --partial-match When enabled, enables partial matching.
  • Introduces code to mimic slower, partial-match inntersection/diff methods
  • Introduces tests to test how this works

Fixes #187

This changeset introduces a way to do partial matching on license names.

Say, to match all BSD licenses for a given --fail-on=BSD.

To do so, it:
* Introduces a new cli boolean parameter (default false), called --partial-match
  When enabled, enables partial matching.
* Introduces code to mimic slower, partial-match inntersection/diff methods
* Introduces tests to test how this works
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.12%. Comparing base (6ab64cd) to head (f69136c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #186      +/-   ##
==========================================
+ Coverage   99.08%   99.12%   +0.04%     
==========================================
  Files           1        1              
  Lines         435      457      +22     
==========================================
+ Hits          431      453      +22     
  Misses          4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@raimon49
Copy link
Owner

Thanks for the implementation idea and code! It looks good because it's the default false, so it won't break the CI of existing users.

I would like to see the role of this option written in the README document. This feature appears to be used in combination with --fail-on or --allow-only. Users would appreciate an explanation in the "Verify options" section of the README. What do you think?

@costasd
Copy link
Contributor Author

costasd commented Mar 27, 2024

oh missed the readme, you're right, will add it there!

@raimon49
Copy link
Owner

Thanks a lot! I will merge this PR and upload the next release v4.4.0 to PyPI.

@raimon49 raimon49 merged commit c6e0a0d into raimon49:master Mar 28, 2024
7 checks passed
@raimon49 raimon49 mentioned this pull request Mar 28, 2024
@raimon49
Copy link
Owner

@costasd We have the --partial-match option available in v4.4.0 🎉
https://pypi.org/project/pip-licenses/4.4.0/

Thank you for your contribution.

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.

Consider enabling partial matching for licenses
2 participants