license-expression
license-expression is a comprehensive utility library to parse, compare, simplify and normalize license expressions (such as SPDX license expressions) using boolean logic.
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained library (latest release 2025-07-22) with low install friction, no known vulnerabilities, and a permissive Apache-2.0 license. It fills a genuine need for SPDX license expression handling in Python—the description notes there is no known alternative in Python. Install it if you need to parse, validate, or manipulate license expressions programmatically.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction installation with a single runtime dependency (boolean.py).
- Active maintenance with recent releases; last commit on 2026-05-26 and latest release on 2025-07-22.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is a permissive license. You can use, modify, and distribute this package freely in commercial and private projects, provided you include a copy of the license and state significant changes.
last release 2025-07-22 (388 days) · last repo commit 2026-05-26 · 73 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 39,385,607 downloads/mo, #698 on PyPI
Alternatives
Verify before relying
pip install license-expression
from license_expression import get_spdx_licensing
licensing = get_spdx_licensing()
parsed = licensing.parse('GPL-2.0-or-later WITH Classpath-exception-2.0 AND MIT')
print(str(parsed))- Whether the bundled SPDX license list (version 3.26) and ScanCode LicenseDB (from scancode-toolkit 32.3.1) are automatically updated with package releases.
- Performance characteristics when parsing very large or deeply nested license expressions.
- API stability guarantees or deprecation policy for the Licensing and LicenseSymbol classes.
What it is and what it does
license-expression is a library for parsing and manipulating license expressions—standardized text representations of software licenses, particularly those following the SPDX specification. It handles complex multi-license scenarios like 'GPL-2.0-or-later WITH Classpath-exception-2.0 AND MIT' by treating them as boolean expressions that can be parsed, validated, compared, and simplified. The library includes the SPDX License list (version 3.26) and ScanCode LicenseDB to recognize and normalize license identifiers.
You use it by creating a Licensing object (either SPDX-based or custom), then parsing expressions into structured objects you can inspect, compare, or render back to normalized text. It's designed for projects that need to programmatically work with license metadata—such as build tools, package managers, SBOM generators, and compliance scanners—rather than just reading license text as strings.
Use it for
- Validate and normalize license metadata in package manifests or software bills of materials (SBOMs).
- Parse complex license expressions in build systems or package managers to determine compatibility or licensing requirements.
- Compare license expressions to detect duplicates or equivalences in dependency trees.
- Simplify redundant license expressions (e.g., 'GPL OR GPL' → 'GPL') for cleaner metadata.
- Implement license compliance checking by programmatically testing whether a project's license expression matches policy rules.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained library (latest release 2025-07-22) with low install friction, no known vulnerabilities, and a permissive Apache-2.0 license. It fills a genuine need for SPDX license expression handling in Python—the description notes there is no known alternative in Python. Install it if you need to parse, validate, or manipulate license expressions programmatically.
Install
license-expression on PyPI
Before you install
Low friction installation with a single runtime dependency (boolean.py). Active maintenance with recent releases; last commit on 2026-05-26 and latest release on 2025-07-22. Requires Python 3.9 or later.
Requires Python 3.9 or later.
License in practice
Apache-2.0 is a permissive license. You can use, modify, and distribute this package freely in commercial and private projects, provided you include a copy of the license and state significant changes.
Quickstart
pip install license-expression
from license_expression import get_spdx_licensing
licensing = get_spdx_licensing()
parsed = licensing.parse('GPL-2.0-or-later WITH Classpath-exception-2.0 AND MIT')
print(str(parsed))
Verify before relying
- Whether the bundled SPDX license list (version 3.26) and ScanCode LicenseDB (from scancode-toolkit 32.3.1) are automatically updated with package releases.
- Performance characteristics when parsing very large or deeply nested license expressions.
- API stability guarantees or deprecation policy for the Licensing and LicenseSymbol classes.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageboolean.py |
| Maintenance | Actively maintained 388 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 39,385,607 / month, #698 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: Utilities |
Evidence: license_expression-30.4.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “license expression parsing”
- license-expressionParses, validates, simplifies, and normalizes license expressions…
- pyspdxValidates and tokenizes SPDX license expressions according to the…
- spdx-toolsParse, validate, create, and convert SPDX software license documents…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also boolean.py · pyspdx · reuse · spdx-tools · liccheck · tag-expressions · cucumber-tag-expressions · pip-licenses-cli · py-expression-eval · cel-expr-python