Repository navigation
Add --package-summary post-scan CLI flag for package-level summaries - #5390
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>
|
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). |
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. |
|
As requested, I have preserved the full commit history and authorship from PR #3792 and opened PR #5398 (GitHub does not permit non-maintainers to reopen PRs closed by maintainers): #5398 All original 60 commits by @swastkk have been retained, merge conflicts with develop resolved, and previous review comments addressed. |
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