Skip to main content

licwatch: catch a dependency's license change before you ship it.

A CI check that fails your build when a dependency changes license, goes unknown, or adds obligations.

pip install git+https://github.com/calasdan-sketch/licwatch.git

Needs Python 3.11 or newer (check with python --version). Not on PyPI yet; once it is, pip install licwatch will work.

$ licwatch baseline
baseline written: licwatch-baseline.json (1 dependencies)
$ licwatch check
PASS: no license changes
  note: read package.json (1 entries)

Real output from a throwaway folder whose package.json pins left-pad 1.3.0. For what a failing check looks like, see Example output.

  • Diffs published licenses, not your code. For every pinned dependency it compares the license the registry publishes (and the LICENSE file inside the tarball) against a baseline you commit.
  • Says what changed and what it obligates you to. Relicense, unknown license, new copyleft or source-available terms, new dependency: each flag names the exact change.
  • Runs anywhere, asks for nothing. Standard library only, no keys, no accounts, no telemetry; reads public npm and PyPI.

License Python

Quickstart

licwatch scan        # what licenses are in this project right now?
licwatch baseline    # record them; commit licwatch-baseline.json
licwatch check       # CI gate: exit 1 on any license flag, 0 when clean

licwatch --help lists every command with examples. Add licwatch check to CI (see CI example).

Limits up front

  • Team tier features (policy packs, legal review queue) — planned paid tier, deliberately out of the free core.
  • Private registries — public npm and PyPI only.
  • yarn.lock / pnpm-lock — custom formats without a stdlib parser; npm's package-lock covers the default toolchain.
  • SBOM export, dashboards, auto-fix, compatibility matrices — refused, not deferred. licwatch is the gate: it reports what changed and what it obligates, it never inventories for its own sake, never changes your build, and never adjudicates whether two licenses combine. See REVIEW.md for the panel's reasoning.
  • Legal advice — licwatch reports what changed and what the license obligates in general terms. It is not a lawyer; a flagged relicense means "a human reviews this before shipping", not a verdict on your specific use.

Why this exists

A dependency changes license in a minor bump and your legal exposure changes overnight with no code change at all. Elasticsearch (2021), Terraform (2023), and Redis (2024) each moved to source-available licenses (as of 2025, Elasticsearch and Redis have since added AGPL-3.0 as an option). Few teams watch licenses; most watch CVEs.

licwatch is the CI gate for that gap. It diffs published license metadata per dependency per version against a baseline lockfile and fails the build with the exact change:

  • license changed (MIT → SSPL/BSL-style)
  • license went unknown
  • new obligations introduced (copyleft, source-available restrictions, new attribution requirements)
  • new dependency added (new legal exposure)
  • license text changed inside the published tarball even though the registry metadata stayed the same (the metadata blind spot — see below)

The whole report is one shape: what changed, what it obligates you to.

The tarball LICENSE-text layer

Registry metadata can lie by omission: a maintainer who changes the LICENSE file without updating the metadata field is invisible to metadata-only diffing. So licwatch also fingerprints the LICENSE file inside the published tarball (whitespace-collapsed sha256 with copyright lines stripped, read in-memory — never extracted to disk). At check time, only deps whose version bumped AND whose metadata license is unchanged get a fingerprint comparison — the only case where the layer adds signal, so the cost stays bounded. A difference fails the gate as LICENSE_TEXT_CHANGED.

The same layer identifies licenses from LICENSE text when metadata is UNKNOWN or says "SEE LICENSE IN LICENSE" (most such packages are MIT/Apache with text in the file, not proprietary). Identification uses distinctive grant phrases in the head of the file only, so third-party notice sections can't false-positive a proprietary file into an open license. A fetch failure degrades to a "license-text unverified" note, never a gate failure — the metadata gate stays primary. --no-text skips the layer entirely.

Install (local)

pip install .
# or, for development:
pip install -e .

Requires Python 3.11+ (stdlib tomllib). No third-party dependencies, no keys, no accounts, no telemetry, no phone-home. Registry reads are public, unauthenticated GETs to registry.npmjs.org and pypi.org.

Usage

# What licenses are in this project right now?
licwatch scan

# Record the baseline (commit licwatch-baseline.json)
licwatch baseline

# The CI gate: exit 1 on any license flag, 0 when clean
licwatch check

# Human-readable summary (never fails the build)
licwatch report

# Accept ONE flagged dependency into the baseline (the rest stay flagged)
licwatch accept redis

# What changes if I bump this package? (a query, never a gate)
licwatch whatif redis@5.0.0

Options: --path <dir> (default: current directory), --ecosystem npm|pypi|all (default: all), --include-dev (include devDependencies / dev lock entries), --json (machine-readable output), --baseline <file> (check/report), --allow-added (check: treat new dependencies as notes, not failures), --allow-unpinned (check: do not fail on unpinned dependencies), --no-text (baseline/check/report: skip the tarball LICENSE-text layer), --jobs <n> (parallel registry fetch workers, default 8), --output <file> (baseline).

Exit codes: 0 pass/clean, 1 gate failed, 2 usage or resolution error (missing baseline, malformed manifest, registry failure, or unverified dependencies — see below).

A green gate means every dependency licwatch could read was checked against the baseline. It does not cover what licwatch cannot see: git/URL/editable installs are listed as notes only, and every pinned version is compared (if a lockfile holds several versions of one package, each is its own baseline entry, keyed npm:name@version). check exits 2 when any dependency is unpinned (it cannot be checked — pin it or commit a lockfile, or pass --allow-unpinned to knowingly proceed) and when any registry fetch fails (the failing dep is reported as an error, never misreported as removed, and findings for resolved deps are still printed).

Manifests read: package.json, package-lock.json (locked versions win over ranges), requirements.txt (with -r includes followed, and -c/--constraint files followed the same way: a name left unpinned in requirements but pinned with == in a constraints file is checked at that pin; names only in constraints are not added), pyproject.toml (PEP 621 dependencies), Pipfile.lock, poetry.lock, uv.lock (registry packages only; git/path/editable sources are noted, and the project itself is excluded; uv.lock does not mark dev packages individually, so all locked packages are checked, as with poetry.lock). Lockfiles win over plain manifests — they describe the resolved tree including transitive deps. Only pinned versions are checked — an unpinned range has no single published license, so it is reported as skipped, never silently resolved to "latest". URL/editable installs are noted, not vanished.

Accepting a change (the workflow)

licwatch check        # FAIL: redis 4.0.0 -> 5.0.0: BSD-3-Clause -> BUSL-1.1
# ... human reviews the change ...
licwatch accept redis # updates ONLY redis in the baseline
licwatch check        # every other flag still fails; redis is clean

licwatch accept redis --reason "legal OK'd BUSL for internal use, ticket LEG-42" stores the reason on that baseline entry, with a UTC timestamp and the from/to licenses. --reason is optional; without it the entry records reason: null. licwatch report prints each accepted change with its recorded reason (or "no reason recorded"). It is a record of what someone wrote, not an approval: licwatch does not check who accepted or whether the reason is sound.

Re-running baseline to accept one change would silently bless every other drift since the last baseline. accept exists so that never happens: one reviewed change, one updated entry.

CI

When GITHUB_ACTIONS=true is set, check additionally prints ::error annotations for failing dependencies, so flags appear inline on the PR. No flags, no setup — it auto-detects.

Registry hiccups: HTTP 429, 5xx, timeouts and network errors are retried up to twice (waiting 1 s, then 3 s, or the server's Retry-After capped at 10 s). A 404 is never retried. If all 3 attempts fail, the dependency is reported as a registry error ("... after 3 attempts"), never as a pass.

Example output

Clean check:

PASS: no license changes

Gate failing on a relicense (illustrative data, not a real npm release; BSD-3-Clause → BUSL-1.1):

FAIL: 2 license flag(s)
  [CHANGED] redis [npm] 4.0.0 -> 5.0.0: BSD-3-Clause -> BUSL-1.1
      obligates you to: preserve copyright and license notices (attribution)
      obligates you to: source-available license — commercial use or redistribution restricted; review terms before shipping
  [RESTRICTIVE_INTRODUCED] redis [npm] 4.0.0 -> 5.0.0: BSD-3-Clause -> BUSL-1.1
      obligates you to: preserve copyright and license notices (attribution)
      obligates you to: source-available license — commercial use or redistribution restricted; review terms before shipping

Gate failing on a newly added dependency:

FAIL: 1 license flag(s)
  [ADDED] redis [npm] added at 4.0.0: license MIT
      obligates you to: preserve copyright and license notices (attribution)

SPDX expressions are handled: AND takes the most restrictive term, OR takes the least restrictive (the licensee may choose), and WITH exceptions keep the base license's category. An identifier licwatch cannot classify is reported as unknown — never silently treated as permissive.

CI example

- run: pip install .
- run: licwatch check

Commit licwatch-baseline.json and review it like a lockfile: every entry is a legal fact about your build. The baseline records when it was generated and which manifests were read.

License

MIT — see LICENSE. Changes: CHANGELOG.md. Panel review notes: REVIEW.md.


Made by Calas Automations (CAL-us). Need help? Call Cara 431-244-9026.

Metadata

Release files for licwatch 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for licwatch 0.2.2
File Size Uploaded Provenance Actions
licwatch-0.2.2.tar.gz 50.8 kB Without provenance Details for licwatch-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for licwatch 0.2.2
File Interpreter ABI Platform Actions
licwatch-0.2.2-py3-none-any.whl Python 3 none any Details for licwatch-0.2.2-py3-none-any.whl

Total release size: 86.6 kB

Release files / licwatch-0.2.2.tar.gz

Download URL licwatch-0.2.2.tar.gz
Size 50.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2470aabfc74086e21b30390c4313f68a61377c766d79f2bcc888dc0bbd6fcfea
BLAKE2b-256 checksum
How to use checksums
37c415108ae4e7139b5f46e467f1b646b95a2230e0b3fad78e9dc57e2183446d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / licwatch-0.2.2-py3-none-any.whl

Download URL licwatch-0.2.2-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b0747016ed2b98ccb30af544e6aafd1301b3207f62b9f963746379d170503a5
BLAKE2b-256 checksum
How to use checksums
f93df34926b4964ba8088e134367ef16ef6919ca37302e5582968c6f9e60d7b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for licwatch 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page