Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.1 instead.
Reason given by maintainers: Classification bug: permissive licences could be reported as strong copyleft. Fixed in 0.1.1.

copyleft-audit

Fail your CI build when a dependency's licence breaks policy. Detects GPL, AGPL, SSPL, LGPL, MPL and friends in the packages actually installed in your environment — and exits non-zero so the pipeline stops.

Zero runtime dependencies. Standard library only. It will not touch your dependency tree, and it makes no network calls.

pip install copyleft-audit
copyleft-audit

Why this exists

pip-licenses and similar tools list licences for a human to read. That is a different job from enforcing a policy in CI. If you ship closed-source software, the question is not "what licences are in here" but "does the build stop when someone adds an AGPL package". This tool answers the second question: one command, an exit code, no configuration file required.

Typical triggers for needing it: legal asks you to prove no copyleft code ships in the product; an acquirer's due-diligence checklist asks the same; or you just want the check to run automatically instead of once a year.

Usage

copyleft-audit [--fail-on {strong,weak,unknown}] [--ignore PKG[,PKG...]]
               [--format {text,json}] [--quiet]
Exit code Meaning
0 Clean — no policy violations
1 Policy violation
2 Usage or internal error

GitHub Actions:

- name: Licence gate
  run: |
    pip install copyleft-audit
    copyleft-audit --fail-on strong

Stricter, for a product that cannot even take weak copyleft or unresolvable metadata:

copyleft-audit --fail-on unknown --ignore mypackage,internal-sdk

Machine-readable output, for feeding another tool:

copyleft-audit --format json
{
  "packages":  [{"name": "...", "version": "...", "license": "...",
                 "license_source": "...", "tier": "...", "ignored": false}],
  "violations": ["... same shape ..."],
  "warnings":   ["... same shape ..."],
  "summary":   {"tool_version": "...", "fail_on": "strong", "scanned": 0,
                "unreadable": 0, "ignored": [], "counts": {}, 
                "violation_count": 0, "warning_count": 0, "exit_code": 0}
}

The JSON schema is stable within the 0.1.x line; new keys may be added, and existing keys will not change meaning without a version bump.

Risk tiers

Tier Licences Default
STRONG_COPYLEFT GPL-2.0, GPL-3.0, AGPL-3.0, SSPL, OSL, EUPL fail
WEAK_COPYLEFT LGPL-2.1, LGPL-3.0, MPL-2.0, EPL-2.0, CDDL, CPL warn
PERMISSIVE MIT, BSD, Apache-2.0, ISC, PSF, Unlicense, CC0, Zlib, … pass
UNKNOWN no resolvable licence metadata warn

--fail-on weak promotes weak copyleft to a failure. --fail-on unknown promotes both weak copyleft and unknown metadata to a failure.

How it decides, precisely

Licence metadata is read in this order, and the first source that resolves wins: License-Expression (PEP 639) → License :: trove classifiers → the free-text License field. The source used is reported in license_source, so you can see what the verdict rests on.

Deliberate design choices worth knowing about:

  • UNKNOWN is a real answer. When metadata is missing, empty, or not recognised, the tool says UNKNOWN. It never guesses a tier. A confident wrong answer here would be worse than no answer.
  • A package whose metadata cannot be parsed is reported as UNKNOWN, never skipped. Silently dropping a package would produce a false clean report.
  • LGPL and AGPL are never read as GPL. Matching is on whole tokens and masked phrases, not substrings — the classic mis-tiering bug in naive scanners.
  • MIT OR GPL-3.0 resolves to permissive, because you may take the MIT option. AND resolves to the stricter operand. Parenthesised SPDX expressions are not parsed and are scored conservatively (highest risk wins).
  • Multiple licence classifiers are read as a choice, so the lowest-risk one governs — but every licence string found is printed, so nothing is hidden.

Limits — please read before trusting it

  • It reads declared package metadata only. It does not scan source files, vendored code, bundled binaries, or transitively linked native libraries. A package that declares MIT while vendoring GPL code will read as MIT.
  • It classifies what is installed in the current environment, so run it in the same environment your build produces.
  • This is not legal advice, and the output is not a legal opinion. It is a metadata heuristic that helps engineers catch the obvious cases early. Real licence compliance decisions belong with your counsel.

Paid: auditor-ready attestation report

The tool is free and stays free — nothing is gated behind payment.

If you need the output as a document you can hand to an acquirer, an auditor, or your own legal team, there is a one-time paid report for a single project: every installed dependency with its declared licence, the metadata field that licence was read from, its risk tier, and an explicit list of everything that came back UNKNOWN with what is missing. Delivered as PDF plus the raw JSON. $149, one project, one-time.

Order the attestation report

Same honesty applies: the report documents declared metadata, and it is not a legal opinion.

Disclosure

This package was written by an AI agent (Claude) operating autonomously, and is published and maintained under human ownership. It is deliberately small, dependency-free and standard-library-only so that it can be read end to end and verified by inspection before you trust it in a pipeline. Please do read it.

Licensed MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copyleft_audit-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

copyleft_audit-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file copyleft_audit-0.1.0.tar.gz.

File metadata

  • Download URL: copyleft_audit-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for copyleft_audit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68fff07e7f08eb6c74096db8889a83b434046e501698832261503622bdb5a7fe
MD5 65dfdf05b4608a7e1791f03c03222453
BLAKE2b-256 63ca0a4343773bc66b1c3203e509d5afd9a40967761b09f204deaa3f02f6ff20

See more details on using hashes here.

File details

Details for the file copyleft_audit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: copyleft_audit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for copyleft_audit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae63e7febca5f6782dc634d5e130a298dc3147325d572b995d69ad936e0b2d1
MD5 388ebd38b7089de27b5f866be90a76ec
BLAKE2b-256 fea21c6470b916ae14db5da8c569869a251ce94c5ff3c95343b0fdf58e24e501

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

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