Get the SPDX License ID from license text
Project description
LicenseID
A portable license ID matcher. Get the SPDX License ID from license text.
licenseid takes license text as input and identifies the closest matched SPDX License ID using a hybrid search strategy (trigram + token ratio ranking).
Features
- Hybrid strategy:
- Tier 1: Broad recall using SQLite FTS5 with trigram tokenization.
- Tier 2: Precision ranking using RapidFuzz (token set ratio) + Popularity weighting.
- Tier 3: Optional final validation via
tools-javaif available.
- Unix philosophy: Parseable CLI output.
Installation
Install with pipx:
pipx install licenseid
Or using uv:
uv tool install licenseid
Usage
1. Update the license database
Before matching, you need to build the local license index:
licenseid update
Advanced update options:
--version <version>: Download a specific SPDX License List version (e.g.,3.26.0).--force: Force update even if the local database is already at the target version.--no-cache: Bypass the local cache for downloads.
2. Match a license
Identify license text from a file:
licenseid match LICENSE.txt
Or match from a string:
licenseid match --text "MIT License"
Common options:
--java: Enable Tier 3 Java validation (requiresSPDX_TOOLS_JARandjpype1).--pop: Enable popularity weighting as a tie-breaker.--json: Output results in JSON format.--db <path>: Use a custom database path (global option).
The popularity tie-breaker is triggered when candidate similarity scores differ by less than 0.2%.
3. Cache management
licenseid maintains a local cache of remote data to save bandwidth.
licenses.json: Cached for 45 days.popularity.csv: Cached for 75 days.- SPDX data tarballs are versioned and never expire.
To clear the cache manually:
licenseid --clear-cache
4. Output formats
Default (Unix-friendly):
LICENSE_ID=Apache-2.0 SCORE=0.9850
JSON:
licenseid match LICENSE.txt --json
Configuration
SPDX_TOOLS_JAR: Path to thetools-javajar for Tier 3 validation.
License
Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file licenseid-0.1.1.tar.gz.
File metadata
- Download URL: licenseid-0.1.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdebd3bf7bc9da63551b993771bf547e4fc1789895b536a884d774e426a72615
|
|
| MD5 |
e354831b36722e9acde0a17fa2e5367b
|
|
| BLAKE2b-256 |
c7cf593cc527b818f89ff5fcc6fbc974ac1d63d74c6d2e2d86c057c3b22553c5
|
Provenance
The following attestation bundles were made for licenseid-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on bact/licenseid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
licenseid-0.1.1.tar.gz -
Subject digest:
bdebd3bf7bc9da63551b993771bf547e4fc1789895b536a884d774e426a72615 - Sigstore transparency entry: 1397100416
- Sigstore integration time:
-
Permalink:
bact/licenseid@e86e2d1e3ccd6066b2bfbf3ce4e8fc588630cbc1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bact
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@e86e2d1e3ccd6066b2bfbf3ce4e8fc588630cbc1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file licenseid-0.1.1-py3-none-any.whl.
File metadata
- Download URL: licenseid-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
133182f71c6cefea85eedbdb71171e39a89f3ce308fd20c3d0d512037b32030e
|
|
| MD5 |
a3164fd2af7d62890a61a11c586d7f7b
|
|
| BLAKE2b-256 |
098503e75eb8a3123e89a8ba689ef2290d58e51725d437aa92770cfe9f704f4d
|
Provenance
The following attestation bundles were made for licenseid-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on bact/licenseid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
licenseid-0.1.1-py3-none-any.whl -
Subject digest:
133182f71c6cefea85eedbdb71171e39a89f3ce308fd20c3d0d512037b32030e - Sigstore transparency entry: 1397100435
- Sigstore integration time:
-
Permalink:
bact/licenseid@e86e2d1e3ccd6066b2bfbf3ce4e8fc588630cbc1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bact
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@e86e2d1e3ccd6066b2bfbf3ce4e8fc588630cbc1 -
Trigger Event:
release
-
Statement type: