Add license compatibility checking #22
Labels
No labels
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
marvin8/zaojun#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
zaojun currently checks versions and CVEs per dependency. This issue tracks adding license compliance checking as an opt-in feature.
The PyPI JSON API response already includes license metadata in the same per-package call zaojun already makes — so this is zero extra HTTP requests.
What it will do:
info.license_expression,info.classifiers,info.license) in priority orderproject.license)unknown-license = "warn"— packages with no license metadata warn but do not failNew config keys:
check-licenses(bool, CLI + config, default: false)allowed-licenses(list of SPDX IDs, config-only; empty = auto-derive from project license)unknown-license(str: "warn" | "fail" | "allow", CLI + config, default: "warn")license-ignore(list of dicts with requiredpackageandreasonfields, config-only)Approach and key files:
License data resolution (priority order)
info.license_expression— PEP 639 SPDX expression (most authoritative)info.classifiers— parse Trove classifier e.g. "License :: OSI Approved :: MIT License" → "MIT"info.license— free text, normalise known strings to SPDX IDsNone→ treated as UNKNOWNAuto-derivation from project license
Read
project.licensefrom the checked project's ownpyproject.toml. Map the SPDX ID to a compatibility tier:Note: GPL-2.0-only excludes Apache-2.0 deps due to patent-clause incompatibility.
Key files
src/zaojun/licenses.py— tier frozensets, SPDX extraction, inferencetests/test_licenses.pydocs/usage/license-checking.mdsrc/zaojun/config.py— 4 new config keys + validatorssrc/zaojun/__init__.py— DependencyResult fields, get_latest_pypi_version 4-tuple, process_dependencies, renderingCommit sequence (TDD)
:wrench:tooling/CI dependency bumps (existing uncommitted changes):white_check_mark:failing tests for licenses.py:sparkles:implement licenses.py:white_check_mark:failing tests for config keys:sparkles:implement config.py changes:white_check_mark:failing tests for PyPI fetch + cache license field:sparkles:extract license from PyPI response:white_check_mark:failing tests for compliance checking + output:sparkles:wire license checking into process_dependencies + CLI:memo:documentation