How cyclonedx/cyclonedx-python works
CycloneDX Python is a CLI tool that builds SBOMs from installed Python environments, requirements files, Poetry projects, or Pipenv projects. The user selects a source and options; the corresponding source handler reads package metadata and dependency declarations, constructs a CycloneDX BOM, and the CLI produces the requested document. The graph includes README-documented input branches, but their detailed wiring is not all visible in the sampled source. The environment and Poetry paths are supported by excerpts; other handler internals are represented at their exact tree paths.
Main entry points: cli.py Command dispatcher · environment.py Environment scan · poetry.py Poetry input · requirements.py Requirements input
Components 15
CLI entry
- Module entry
cyclonedx_py/__main__.py - Command dispatcher
cyclonedx_py/_internal/cli.py
Input sources
- Environment scan
cyclonedx_py/_internal/environment.py - Requirements input
cyclonedx_py/_internal/requirements.py - Poetry input
cyclonedx_py/_internal/poetry.py - Pipenv input
cyclonedx_py/_internal/pipenv.py
Metadata processing
- Project metadata
cyclonedx_py/_internal/py_interop/packagemetadata.py - PEP 621 parsing
cyclonedx_py/_internal/utils/pep621.py - License mapping
cyclonedx_py/_internal/utils/license_trove_classifier.py
SBOM generation
- CycloneDX helpers
cyclonedx_py/_internal/utils/cdx.py - CycloneDX library
- SBOM document
Other components
- CLI user
- Python environment
- Project manifests
Connections 22
- CLI user → Module entry: runs module
- CLI user → Command dispatcher: runs command
- Module entry → Command dispatcher: invokes
- Command dispatcher → Environment scan: dispatches
- Command dispatcher → Requirements input: dispatches
- Command dispatcher → Poetry input: dispatches
- Command dispatcher → Pipenv input: dispatches
- Python environment → Environment scan: provides packages
- Project manifests → Requirements input: provides requirements
- Project manifests → Poetry input: provides manifests
- Project manifests → Pipenv input: provides manifests
- Environment scan → Project metadata: reads metadata
- Environment scan → CycloneDX helpers: uses BOM helpers
- Poetry input → CycloneDX helpers: uses BOM helpers
- Project metadata → PEP 621 parsing: uses parsing
- PEP 621 parsing → License mapping: maps classifiers
- Environment scan → CycloneDX library: builds BOM
- Requirements input → CycloneDX library: builds BOM
- Poetry input → CycloneDX library: builds BOM
- Pipenv input → CycloneDX library: builds BOM
- Command dispatcher → CycloneDX library: serializes BOM
- CycloneDX library → SBOM document: emits document