spdx-python-model
SPDX Model Python Bindings
What it is and what it does
spdx-python-model is a Python library that provides direct bindings to the SPDX 3 specification through auto-generated classes. The bindings are created from the official RDF and SHACL definitions of SPDX 3 using shacl2code during package build, ensuring they stay synchronized with the specification. It exposes low-level, direct access to SPDX data structures organized by version (e.g., v3_0_1), allowing you to instantiate and manipulate SPDX objects programmatically.
The library is intended for developers who need to work directly with SPDX files or build SPDX documents from code. It includes a load() API that can automatically detect and deserialize SPDX documents from disk. However, the bindings are intentionally low-level—they lack higher-level convenience functions for common SPDX creation tasks. If you need a more ergonomic API, the SPDX Python Tools project offers a higher-level interface, though it does not yet support SPDX 3.
Use it for:
- Parse and deserialize existing SPDX 3 JSON documents into Python objects for inspection or modification
- Programmatically construct SPDX 3 documents from scratch by instantiating model classes like Person, Package, or Bundle
- Build software bill-of-materials (SBOM) generation tools that emit valid SPDX 3 output
- Integrate SPDX 3 data handling into build systems or CI/CD pipelines that need to work with standardized software metadata
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python bindings for the SPDX 3 data model, enabling direct manipulation of SPDX documents through auto-generated classes from RDF and SHACL specifications.
Yes, if you need to work with SPDX 3 documents in Python. The library has low install friction, no runtime dependencies, active maintenance, and permissive licensing. It is the canonical bindings for SPDX 3 and supports modern Python versions. Caveat: it is low-level and lacks convenience helpers—suitable for direct manipulation but not for rapid prototyping of SPDX workflows.
Install
spdx-python-model on PyPI
pip
pip install spdx-python-modeluv
uv add spdx-python-modelpoetry
poetry add spdx-python-modelInstalling spdx-python-model
Before you install
Low installation friction with no runtime dependencies. Active maintenance with a release 52 days ago and recent commits. Supports Python 3.9 through 3.14.
License in practice
Apache-2.0 permissive license allows use in most commercial and open-source projects with minimal restrictions.
Quickstart
pip install spdx-python-model
import spdx_python_model
p = spdx_python_model.v3_0_1.Person()
# Or load from an SPDX file
from pathlib import Path
model, objset = spdx_python_model.load(Path("/path/to/file.spdx3.json"))
Requires Python 3.9 or later. Building from source with local SPDX model files requires setting SHACL2CODE_SPDX_DIR environment variable.
Verify before relying
- Whether the low-level bindings are suitable for typical SPDX document creation workflows without higher-level helpers
- Performance characteristics when working with large or complex SPDX documents
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 52 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 173,470/month — #10,307 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: spdx_python_model-0.0.6-py3-none-any.whl
Keywords: bindings, sbom, shacl2code, software-bill-of-materials, spdx, spdx3
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
spdx3-validateValidates SPDX 3 documents with context-aware…
permissive · top 15,000 on PyPI
lib4sbomLib4sbom parses and generates Software Bill of…
permissive · top 15,000 on PyPI
spdx-toolsParse, validate, create, and convert SPDX…
permissive · top 5,000 on PyPI
pyshaclValidates RDF graphs against SHACL shape…
permissive · top 5,000 on PyPI
cyclonedx-python-libProvides data models, validators, and…
permissive · top 1,000 on PyPI
pyspdxValidates and tokenizes SPDX license…
copyleft · top 15,000 on PyPI
distro2sbomGenerates a Software Bill of Materials (SBOM)…
permissive · top 15,000 on PyPI
cyclonedx-bomGenerates Software Bill of Materials (SBOM)…
permissive · top 5,000 on PyPI
cyclonedx-pyGenerates Software Bill of Materials (SBOM)…
unclear · top 15,000 on PyPI
PyShExPyShEx parses and validates RDF data against…
permissive · top 15,000 on PyPI