Skip to main content

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.1.tar.gz (16.4 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.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: copyleft_audit-0.1.1.tar.gz
  • Upload date:
  • Size: 16.4 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.1.tar.gz
Algorithm Hash digest
SHA256 6338b68aec915831c0b505c193bd19a92dcd78d9a0805b2a92d03e11e29cfe34
MD5 74d1b352cca1ca52df4ff95f982e9b4c
BLAKE2b-256 4d64b5d195c08eee02a8e1b013414325f17c430badba90a832c1cac3886a6053

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copyleft_audit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1de39a1ebcb8746f4ae196dfe02ec7c5006218be14ffe999222f75cf957f8645
MD5 240be0b7cc9f0f62a1912c78bb4c3d19
BLAKE2b-256 8bbc1402de1887e770ab101ba643cb348d7681673119b25c5eac1f52a2c41387

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

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