Repository navigation
Add --package-summary post-scan CLI flag for package-level summaries - #5390
Closed
aryan1234-l wants to merge 1 commit into
Closed
aryan1234-l wants to merge 1 commit into
aryan1234-l wants to merge 1 commit into
Conversation
- Implement PackageSummary PostScanPlugin triggered by --package-summary requiring --package and --classify. - Compute license_clarity_score and summarize copyright, holder, notice text, and other detected license expressions for each package instance from its key files and other files. - Preserve backward compatibility of compute_license_score and avoid fixture churn across existing package scan tests by only returning license_clarity_score on packages when --package-summary is enabled. - Add comprehensive test suite in tests/packagedcode/test_package_summary.py and update CLI help fixtures and documentation. Resolves aboutcode-org#3802 Resolves aboutcode-org#3287 Signed-off-by: Aryan Gupta <arynrav11@gmail.com>
Member
|
If you're copying code from #3792 please use the original commits to show your specific changes, and what you're copying and what changes you've made yourself (and why you're creating a new PR). |
Author
Ohh, ok, I'll leave s summary too of my and existing changes, I shall be working on this and once all CI checks pass then consider it. Thankyou for the feedback. |
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.
Summary
This PR implements the
--package-summarypost-scan CLI flag to compute package-level summaries, addressing #3802 and #3287.Previously,
scancodeprovided codebase-level summary and license clarity scoring via--summary/--license-clarity-score, but did not compute license clarity scores or summarized origin attributes for individual package instances.Key Changes
PackageSummaryPost-Scan Plugin (src/packagedcode/plugin_package.py):package-summaryplugin (scancode_post_scanentrypoint) running afterPackageScanner.--packageand--classify.license_clarity_scoreand summary attributes (copyright,holder,notice_text,other_license_expression, andother_license_expression_spdx).Scoring Logic (
src/summarycode/score.py):get_field_values_from_resources()to directly work onResourceobjects (usinggetattr(resource, 'is_key_file', False)), addressing previous review feedback on PR Improve License Clarity at Top Package Level #3792.compute_license_score()to accept eithercodebaseorresourceswhile preserving its 2-tuple return(scoring_elements, declared_license_expression).Package Model Compatibility (
src/packagedcode/models.py):license_clarity_scoreattribute toPackage(PackageData).Package.to_dict(package_summary=False)to prevent breaking or churning existing package scan fixtures across the codebase.Tests & Documentation:
tests/packagedcode/test_package_summary.pycovering npm, python wheels, rubygems, rust packages, and mock key file classification.help.txt,help_linux.txt).CHANGELOG.rstand author credit inAUTHORS.rst.Fixes #3802
Fixes #3287
Signed-off-by: Aryan Gupta arynrav11@gmail.com