Overview
swarmauri_tests_pylicense is a pytest plugin that
scans a package's full dependency tree and ensures each dependency declares a
license. The plugin resolves dependencies recursively, checking every
transitive requirement. It inspects both the License metadata field and
any Classifier entries that declare a license.
By default, the plugin runs in parameterized mode which creates one test per dependency. An aggregate mode is also available that reports all missing licenses in a single test.
Installation
pip install swarmauri_tests_pylicense
pytest automatically discovers the plugin once it is installed.
Usage
Parameterized (default)
Run pytest with the package name to scan its dependency licenses:
pytest --pylicense-package=<your-package>
Each generated test encodes the full dependency path, the resolved version, and the detected license of the terminal package. For example:
swarmauri_tests_pylicense:license::pkg::depA::depB==1.2.3 [Apache-2.0]
Aggregate
Use the --pylicense-mode=aggregate flag to consolidate checks into one test:
pytest --pylicense-package=<your-package> --pylicense-mode=aggregate
Allow and Disallow Lists
To restrict acceptable licenses, provide a comma-separated allow list or disallow list. These can be passed via command-line options or environment variables.
Command-line:
pytest --pylicense-package=<your-package> --pylicense-allow-list=MIT,Apache-2.0
pytest --pylicense-package=<your-package> --pylicense-disallow-list=GPL
Environment variables:
export PYLICENSE_ALLOW_LIST="MIT,Apache-2.0"
export PYLICENSE_DISALLOW_LIST="GPL"
pytest --pylicense-package=<your-package>
If both are provided, any license not in the allow list or explicitly present in the disallow list will cause a test failure. By default, all licenses are allowed and none are disallowed.
Accepting Specific Dependencies
Some transitive dependencies may ship with unusual or proprietary licenses that
are acceptable for your project. Use --pylicense-accept-deps (or the
PYLICENSE_ACCEPT_DEPS environment variable) with a comma-separated list to
explicitly bypass those packages. For example:
pytest --pylicense-package=<your-package> --pylicense-accept-deps=cffi
This tells the plugin to treat cffi as pre-approved. Any license issues for
cffi—including unknown or non-standard licenses—are ignored while other
dependencies continue to be validated normally.
License
Licensed under the Apache 2.0 License.
Metadata
Release files for swarmauri_tests_pylicense 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tests_pylicense-0.1.2.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tests_pylicense-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / swarmauri_tests_pylicense-0.1.2.tar.gz
| Download URL | swarmauri_tests_pylicense-0.1.2.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4836cfcf55cd7b95c08fff316dd9a05d106a64153b7f86507ab311108b4a22e3
|
|
BLAKE2b-256 checksum How to use checksums |
93f14521e8b048099380b89b1cc5a5bdfb285dcefbe7a8e114455dbcc6aee987
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tests_pylicense-0.1.2-py3-none-any.whl
| Download URL | swarmauri_tests_pylicense-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c6ee74922e4dca45c3d547ef1df7780239c93ad89abf2e60bfbf1d6f0108733
|
|
BLAKE2b-256 checksum How to use checksums |
dc8763f8a3dead0bdfe447a59110e94c380422662d2a0b82b79a21eadfc980b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|