license-radar
Scan a project's dependency manifests (requirements.txt, pyproject.toml,
package.json) for license compliance risk before a GPL/AGPL dependency
turns into a legal problem for a closed-source product.
Why
Pulling in a GPL- or AGPL-licensed dependency can obligate a company to open its own source, or expose it to a lawsuit — and it usually happens by accident, several dependency layers deep. Existing SCA/security scanners focus on vulnerabilities; license risk is often an afterthought bolted onto an expensive enterprise product. This is a small, focused tool that does just the license check, fast, in CI.
Install
pip install license-radar
Usage
license-radar scan . # scan a directory (auto-detects manifests)
license-radar scan requirements.txt # scan a single manifest
license-radar scan . --online # also query PyPI/npm for packages not in the local DB
license-radar scan . --json # machine-readable output for CI
license-radar scan . --policy policy.json
Exit code is 1 if any dependency violates the policy (useful as a CI gate),
0 otherwise.
pre-commit
This repo is a pre-commit hook source. Add to a
project's .pre-commit-config.yaml:
repos:
- repo: https://github.com/Hiro-012/claude-
rev: <commit SHA of a published license-radar version>
hooks:
- id: license-radar
(This repo doesn't tag releases yet — pin a commit SHA from the history of
pyproject.toml version bumps until versioned tags are published.)
The hook runs on any commit that touches requirements*.txt, pyproject.toml,
or package.json, and blocks the commit if a new dependency violates policy.
Policy
By default, any strong-copyleft (GPL/AGPL/SSPL) or unknown license is a
violation. Override with a JSON file:
{
"fail_at_or_above": "weak-copyleft",
"treat_unknown_as_violation": false
}
How it classifies
Licenses are normalized to an SPDX id and bucketed into four tiers:
permissive < weak-copyleft < strong-copyleft < unknown. See
license_radar/classify.py for the exact lists.
Limitations
The offline database (license_radar/license_db.py) is a hand-curated table
of ~150 common PyPI/npm packages (each entry verified against the live
registry JSON API), not a registry mirror — use --online for full coverage
against live PyPI/npm metadata (adds a network dependency and is not covered
by the deterministic test suite).
License
MIT
Support
If this project is useful to you, you can support development here: https://buy.stripe.com/bJeeVe2te0U16Ln1yudMI00
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file license_radar-0.1.3.tar.gz.
File metadata
- Download URL: license_radar-0.1.3.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72106bae7df18a1cc5446ecb4effcac3e27b40bb15558cdfb020e32695f063f7
|
|
| MD5 |
b33ab8c2cccb675431c5d732218a9a9f
|
|
| BLAKE2b-256 |
9f72b6a510edafc6fba9d16a261053bcd5fdf189d3c8370bcc88000e98e0d8fb
|
File details
Details for the file license_radar-0.1.3-py3-none-any.whl.
File metadata
- Download URL: license_radar-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b070a9aff33d8e6174bea7843536cfd1e8e2f9d559fe98bd3c14f6a91076528
|
|
| MD5 |
9339af8afa7e56b9d76d65170b4dc403
|
|
| BLAKE2b-256 |
2b75ab06fbbac8c75513dc4c04ee3534466b79976a710d71fbcc89d08e405ee7
|