License solver
Welcome to Thoth’s license-solver repository!
This tool handles license and classifier detection from metadata provided by PyPI. Determines the type of license and its version. It also indicates a discrepancy in the license and in the classifier.
What license-solver does
Detects licenses and classifier from metadata provided by:
PyPI
JSON files
folders with JSON files
dictionary (with function detect_license())
The output is printed by default on STDOUT (you can choose the file where to save the output more in –help).
Good to know
unidentified license/version/classifier are named UNDETECTED
non-versioned licenses have an identifier in license_version LICENSE-WITHOUT-VERSION
Run solver locally
Often, it is useful to run license-solver locally to experiment or verify your changes in implementation. You can do so easily by running:
$ PYTHONPATH=. python3 ./thoth-license-solver <arguments>
Examples
sample with 1 file:
$ thoth-license-solver --file tests/examples/request_example.json -pp 4
Output 1.:
{
"requests": {
"2.27.1": {
"license": [
"Apache License 2.0",
"Apache-2.0",
"Apache 2.0"
],
"license_version": "2.0",
"classifier": [
[
"License :: OSI Approved :: Apache Software License",
"Apache Software License"
]
],
"warning": false
}
}
}
sample with 2 files with the same package but with different versions:
$ thoth-license-solver --file tests/examples/request_example.json tests/examples/request_example_2.json -pp 4
Output 2.
{
"requests": {
"2.27.1": {
"license": [
"Apache License 2.0",
"Apache-2.0",
"Apache 2.0"
],
"license_version": "2.0",
"classifier": [
[
"License :: OSI Approved :: Apache Software License",
"Apache Software License"
]
],
"warning": false
},
"2.24.0": {
"license": [
"Apache License 2.0",
"Apache-2.0",
"Apache 2.0"
],
"license_version": "2.0",
"classifier": [
[
"License :: OSI Approved :: Apache Software License",
"Apache Software License"
]
],
"warning": false
}
}
}
sample with 2 files with the same package but with different versions and with 1 different PyPI package:
$ thoth-license-solver --file tests/examples/request_example.json tests/examples/request_example_2.json --package-name numpy -pp 4
Output 3.
{
"numpy": {
"1.22.1": {
"license": [
"BSD 4-Clause \"Original\" or \"Old\" License",
"BSD-4-Clause",
"BSD 4 Clause"
],
"license_version": "4",
"classifier": [
[
"License :: OSI Approved :: BSD License",
"BSD License"
]
],
"warning": false
}
},
"requests": {
"2.27.1": {
"license": [
"Apache License 2.0",
"Apache-2.0",
"Apache 2.0"
],
"license_version": "2.0",
"classifier": [
[
"License :: OSI Approved :: Apache Software License",
"Apache Software License"
]
],
"warning": false
},
"2.24.0": {
"license": [
"Apache License 2.0",
"Apache-2.0",
"Apache 2.0"
],
"license_version": "2.0",
"classifier": [
[
"License :: OSI Approved :: Apache Software License",
"Apache Software License"
]
],
"warning": false
}
}
}
Installation
Install license-solver:
$ pip install thoth-license-solver
Run tests
It is a good habit for the program to be tested after the implementation of new features. You can run:
$ pytest tests/
# or
$ pytest --cov-report term-missing --cov=thoth tests/ # coverage test
Special aliases
default BSD naming is 4th clause ([source](https://en.wikipedia.org/wiki/BSD_licenses#Terms))
Metadata
Release files for thoth-license-solver 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thoth-license-solver-0.1.5.tar.gz | 80.7 kB | Without provenance | Details for thoth-license-solver-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thoth_license_solver-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for thoth_license_solver-0.1.5-py3-none-any.whl |
Total release size: 156.6 kB
Release files / thoth-license-solver-0.1.5.tar.gz
| Download URL | thoth-license-solver-0.1.5.tar.gz |
|---|---|
| Size | 80.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f96220618b11041c46ac5420e7bfdf62907dedd181a00cacd5e13614399b41b
|
|
BLAKE2b-256 checksum How to use checksums |
84239ead8efefdeeb83abde36963db7062c9b196eceb16204907d5850dbde8f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Release files / thoth_license_solver-0.1.5-py3-none-any.whl
| Download URL | thoth_license_solver-0.1.5-py3-none-any.whl |
|---|---|
| Size | 75.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c5fe5ad5a6290517074a542cc9a76e8098f5d592fdee57f354f4ecd8a1da56f
|
|
BLAKE2b-256 checksum How to use checksums |
bdbc3de20fbefa922d3c572fbb785030e6aa88c5709200c8da397121ccb419aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Security for thoth-license-solver 0.1.5
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.