SBOMs for Python
sbombox generate uses uv export when uv.lock is committed and cyclonedx-py for Poetry, Pipenv and pip projects. Dev dependencies are left out for uv. This page covers that path, the manual commands and the gaps to know about.
At a glance
| Package manager | Built-in SBOM command | What sbombox generate runs | Lockfile to commit |
|---|---|---|---|
| uv 0.9.11+ | Yes, uv export --format cyclonedx1.5 (preview) | uv export, then cyclonedx-py, then cdxgen or syft | uv.lock |
| pip | No | cyclonedx-py requirements, then cdxgen or syft | requirements.txt with pinned (==) versions |
| Poetry | No | cyclonedx-py poetry, then cdxgen or syft | poetry.lock |
| Pipenv | No | cyclonedx-py pipenv, then cdxgen or syft | Pipfile.lock |
| PDM | No | cyclonedx-py on the dependencies declared in pyproject.toml (direct only) | pdm.lock, plus an exported requirements.txt (see below) |
For cyclonedx-py, SBOMBox picks the input in this order: poetry.lock, Pipfile.lock, requirements.txt, uv.lock (converted to pinned requirements with uv export), then [project].dependencies in pyproject.toml.
Generate with SBOMBox
The installer adds the CLI, syft and cyclonedx-py. Run the CLI from the directory that holds pyproject.toml and the lockfile. See Install.
curl -fsSL https://sbombox.com/install.sh | sh
sbombox generate -o sbom.json
sbombox score sbom.jsonThe CLI prints which tool ran, for example Detected: pypi - generated with uv export. Add --upload to upload in the same step, or use sbombox check --fail-under 7 to gate a commit without uploading.
For uv, SBOMBox runs uv export with --frozen --all-packages --no-dev, so the lockfile is not changed, every workspace member is included and dev dependencies are left out. uv records SHA-256 digests only on each component's distribution links. SBOMBox promotes the sdist digest (or a lone wheel's) to the component hash.
To pin the choice, set SBOMBOX_GENERATOR to one or more generator names, comma-separated. SBOMBox tries them in that order and skips any that are not installed. An unknown name fails with the list of valid names.
SBOMBOX_GENERATOR=cyclonedx-py,syft sbombox generate -o sbom.jsonValid names for Python: uv-cyclonedx, cyclonedx-py (alias pypi), cdxgen, syft.
Use the package manager's own tool
uv 0.9.11 or later. CycloneDX export is still a uv preview feature. uv 0.12 prints a warning that it is experimental and may change; --preview-features sbom-export silences it. With --output-file, uv also echoes the SBOM to stdout, so redirect stdout in scripts.
uv export --format cyclonedx1.5 --frozen --all-packages --no-dev --output-file sbom.json > /dev/null--all-packagesis required in a workspace. Without it, exporting from the workspace root silently produces an empty SBOM.--frozenreadsuv.lockas committed and never updates it.--no-devleaves thedevdependency group out of the release SBOM.
Measured on 16 November 2026 with uv 0.12 on a 97-package workspace: the raw uv export output scored 4.8/10 (F). It has a full dependency graph but no component hashes, licenses or supplier. Through sbombox generate the same project scored 6.6/10 (D), with 92 of 97 components hashed. Licenses and supplier are still missing. cyclonedx-py on the same requirements scored 4.5/10 and had no dependency graph.
To add license data, build the SBOM from an installed production environment. cyclonedx-py reads each installed package's metadata:
uv sync --frozen --no-dev
cyclonedx-py environment --pyproject pyproject.toml -o sbom.json .venv/bin/pythonpip. pip has no SBOM command. Pin every version, then use cyclonedx-py:
cyclonedx-py requirements --pyproject pyproject.toml -o sbom.json requirements.txtPoetry. Poetry has no SBOM command. --only main keeps dev and other groups out:
cyclonedx-py poetry --only main -o sbom.json .Pipenv. Pipenv has no SBOM command. cyclonedx-py reads only the default packages unless you pass -d:
cyclonedx-py pipenv -o sbom.json .PDM. PDM has no SBOM command, and cyclonedx-py does not read pdm.lock. Export pinned production requirements first. sbombox generate then picks up requirements.txt.
pdm export -f requirements -o requirements.txt --prod
sbombox generate -o sbom.jsonThen, for a file made by any of these tools:
# See what lowers the score
sbombox score sbom.json --format detailed
# Check a ruleset, e.g. EU Cyber Resilience Act readiness
sbombox compliance sbom.json -p cra-readiness
# Upload it to the active project, labelled with the release
sbombox push sbom.json --version v1.4.0SBOMs inside wheels (PEP 770)
PEP 770 defines a place for SBOMs inside a wheel: .dist-info/sboms/. auditwheel 6.5 and later writes one for the system libraries it bundles, and Hatch's wheel builder has an sbom-files option for including your own. This is useful for consumers of your package. For your own release evidence, keep generating an SBOM of the application as above.
Monorepos and workspaces
- uv workspaces share one
uv.lockat the root. Runsbombox generatefrom the root: it passes--all-packages, so every member is included. - For one SBOM per member, export it by name:
uv export --format cyclonedx1.5 --frozen --package api --no-dev --output-file api-sbom.json > /dev/null. Upload each withsbombox push FILE --project ID. - Poetry and Pipenv projects in subdirectories each have their own lockfile. Run
sbombox generate --dir path/to/projectfor each. - A repository that also contains JavaScript or another ecosystem is scanned with a universal tool first. See Unify SBOMs.
Known gaps and how SBOMBox handles them
| Gap | Effect | What SBOMBox does |
|---|---|---|
| uv puts digests only on distribution links | No component hashes | Promotes the sdist (or lone wheel) SHA-256 to the component hash |
| uv export has no licenses or supplier | License and supplier checks fail | Reports them; build from an installed environment for licenses |
uv workspace root exports nothing without --all-packages | Empty SBOM | Always passes --all-packages; an empty result falls through to the next tool |
| Older uv has no CycloneDX export | Built-in not available | Converts uv.lock to pinned requirements and runs cyclonedx-py |
cyclonedx-py poetry follows Poetry's default groups | Non-optional groups such as dev can be included | Runs it with defaults; use --only main yourself for a strict release SBOM |
cyclonedx-py does not read pdm.lock | Direct dependencies only, unpinned | Uses requirements.txt when present; export one with pdm export |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
uv.lock is out of date. Run uv lock, commit uv.lock, and try again. | pyproject.toml changed after the lock | Run uv lock, commit uv.lock, run again |
Generator cyclonedx-py failed: no requirements.txt, poetry.lock, Pipfile.lock, uv.lock or pyproject.toml found. | No Python manifest in the scanned directory | Run from the project root, or pass --dir |
No lockfile for pypi: transitive dependencies may be missing and versions may be guessed. | No lockfile committed | Commit uv.lock, poetry.lock, Pipfile.lock, pdm.lock or a pinned requirements.txt |
Generator uv export produced an SBOM with no components. | uv found nothing to export | Check uv.lock is committed; SBOMBox moves on to the next tool |
| Components with no version | Unpinned requirements.txt or PDM project without an export | Pin with ==, or export with pdm export |
Warning that --format=cyclonedx1.5 is experimental | CycloneDX export is a uv preview feature | Safe to ignore, or pass --preview-features sbom-export |
In CI, run the same commands. See GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines or CircleCI, or use the GitHub Action.
Frequently asked questions
Does pip have an SBOM command?
No. Use a pinned requirements.txt with sbombox generate or cyclonedx-py requirements.
Why is my uv SBOM scored lower than npm?
uv does not record licenses or supplier. Build from an installed environment with cyclonedx-py environment to add licenses.