sphinx-sbom-generator
Generate a Software Bill of Materials (SBOM) as a Sphinx-ready Markdown
document from requirements.txt, pyproject.toml, and/or package.json
manifests. For each package the report includes a short description,
requested and latest versions, license, and known security vulnerabilities
(source: OSV.dev). With --transitive, the tool also
recursively resolves indirect dependencies via the PyPI and npm registries
and surfaces them in a separate section.
Installation
From source:
pip install .
For development:
pip install -e ".[dev]"
Requires Python 3.10+.
Usage
# requirements.txt
sphinx-sbom-generator -r requirements.txt -o docs/sbom.md
# pyproject.toml (PEP 621 / PEP 735 / Poetry)
sphinx-sbom-generator --pyproject pyproject.toml -o docs/sbom.md
# package.json
sphinx-sbom-generator -p package.json -o docs/sbom.md
# Mix any combination in a single report
sphinx-sbom-generator \
-r requirements.txt -r requirements-dev.txt \
--pyproject pyproject.toml \
-p frontend/package.json -p admin/package.json \
-o docs/sbom.md
# Recursively walk transitive dependencies (slower, much larger report)
sphinx-sbom-generator --pyproject pyproject.toml --transitive -o docs/sbom.md
# Tame a deep graph
sphinx-sbom-generator --pyproject pyproject.toml --transitive \
--max-depth 3 --max-packages 500 -o docs/sbom.md
The same is available as a module:
python -m sbom_generator --pyproject pyproject.toml -o docs/sbom.md
Full help:
sphinx-sbom-generator --help
What gets read from pyproject.toml
- PEP 621 (
[project] dependenciesand[project.optional-dependencies]) — the modern standard. - PEP 735 (
[dependency-groups]) — newer dev/lint/test groups. - Poetry (
[tool.poetry.dependencies],[tool.poetry.dev-dependencies], and[tool.poetry.group.<name>.dependencies]).
Direct, git, URL, and path dependencies are skipped — there is no public
registry to enrich them from. Poetry's special python constraint is
also ignored (it isn't a package).
Sphinx integration
With myst-parser, Sphinx renders the generated Markdown directly:
# conf.py
extensions = ["myst_parser"]
source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
In index.rst:
.. toctree::
:maxdepth: 2
sbom
Recommended pattern: invoke the generator in CI immediately before
sphinx-build so the SBOM stays in sync with the manifests:
- run: sphinx-sbom-generator -r requirements.txt -p package.json -o docs/sbom.md
- run: sphinx-build docs docs/_build
Architecture
sbom_generator/
├── models.py Data classes (Package, Vulnerability, ...)
├── cache.py JSON file cache with TTL
├── cli.py Argument parsing + orchestration
├── parsers/
│ ├── base.py ManifestParser base class
│ ├── requirements.py requirements.txt
│ ├── pyproject.py pyproject.toml (PEP 621 + PEP 735 + Poetry)
│ └── package_json.py package.json
├── enrichers/
│ ├── base.py Enricher base class
│ ├── pypi.py PyPI metadata
│ ├── npm.py npm metadata
│ └── osv.py OSV.dev vulnerabilities (batch API)
├── resolvers/
│ ├── base.py DependencyResolver base class
│ ├── pypi.py PyPI requires_dist walker
│ ├── npm.py npm versions[v].dependencies walker
│ └── expander.py BFS expander (cycle-safe, depth-bounded)
└── renderers/
└── markdown.py Markdown for Sphinx
The four layers — parsers → resolvers → enrichers → renderers —
communicate only through the data classes in models.py. Adding a new
ecosystem (Cargo, Maven, ...) means writing one parser, one metadata
enricher, and (if transitive resolution is wanted) one resolver. OSV
covers most ecosystems and can be reused as-is.
Caching
Default location: .sbom-cache/cache.json, TTL 24 hours. Writes are
atomic (temp file + os.replace), so an interrupted run never leaves
the cache in an inconsistent state.
--cache-dir PATH— change the directory--cache-ttl SECONDS— change the TTL--no-cache— disable caching entirely
In CI, caching the cache directory between builds noticeably speeds things up and reduces API load.
What this tool does not do
- Transitive resolution is approximate. With
--transitive, the tool walksrequires_dist(PyPI) andversions[v].dependencies(npm). For PyPI it filters out extras and platform-mismatched markers for the current environment. For npm it picks the version matching a literal pin or otherwise falls back todist-tags.latest— semver ranges (^4.0,~1.2) are not range-resolved. If you need lockfile-precise results, parsepoetry.lock/package-lock.jsonand feed those versions through instead (a lockfile parser fits naturally as another module underparsers/). - No exact version resolution for unpinned specs. When a spec is a range, the report shows the currently latest version. That reflects "what would I deploy today", not "what could ever be installed under this range".
- No license-compliance evaluation. Licenses are surfaced but not checked against an allow-list.
- No setuptools
setup.py/setup.cfgsupport. Project still on those should pin its runtime deps in a generatedrequirements.txt.
Fault tolerance
Per-package failures (package not in registry, network timeout, malformed manifest line) are recorded on the affected package without aborting the run or the report. The SBOM remains useful even when an upstream service is flaky.
Contributing
See CONTRIBUTING.md. Please also read our Code of Conduct.
Security
To report a vulnerability, see SECURITY.md.
AI assistance
Parts of this repository, in particular tests, test data and documentation, were developed or improved with the help of large language models. The maintainer has reviewed and approved them.
License
Metadata
Release files for sphinx-sbom-generator 0.3.1
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 |
|---|---|---|---|---|
| sphinx_sbom_generator-0.3.1.tar.gz | 39.4 kB | With provenance | Details for sphinx_sbom_generator-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_sbom_generator-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for sphinx_sbom_generator-0.3.1-py3-none-any.whl |
Total release size: 74.4 kB
Release files / sphinx_sbom_generator-0.3.1.tar.gz
| Download URL | sphinx_sbom_generator-0.3.1.tar.gz |
|---|---|
| Size | 39.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44f7637aa70433e2245378abcd1e5b94e5131af3f3cc440194c989f6d6d1a9ab
|
|
BLAKE2b-256 checksum How to use checksums |
f249b7dacf2132ed7e088cddb3f55652912913441f7f7a5e5cdb1374ff7c2dee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / sphinx_sbom_generator-0.3.1-py3-none-any.whl
| Download URL | sphinx_sbom_generator-0.3.1-py3-none-any.whl |
|---|---|
| Size | 35.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbf09c87e4fc55c65806c294dab31eabc0bf10973796ea85791dc49819a09a74
|
|
BLAKE2b-256 checksum How to use checksums |
e979f694db3b610e0f7fa90420ac1e002cb72e27605a982f83d2b05317c3ed1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for sphinx-sbom-generator 0.3.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sphinx_sbom_generator-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA 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.