Command line interface¶
Write, convert and check the CycloneDX SBOMs of wheels.
python-sbom [-h] [--version] {embed,archive,spdx,validate} ...
options¶
embed¶
Write the SBOM the hatchling hook writes into wheels another build backend built, such as meson-python. Options come from the [tool.python-sbom] table of the project’s pyproject.toml.
python-sbom embed [-h] [--root DIR] [--commit SHA] [--build-env DIR]
[--content-provider MODULE:ATTRIBUTE]
WHEEL [WHEEL ...]
embed positional arguments¶
WHEEL- wheel to rewrite in place
embed options¶
--rootDIR- project directory of the artifact (default: current directory)--commitSHA- source revision to record, for an artifact built from an sdist--build-envDIR- site-packages directory of the environment that built the artifact; repeat it per directory (default: this interpreter’s)--content-providerMODULE:ATTRIBUTE- content provider, overriding the content-provider option
archive¶
Describe a zip archive that holds the project’s .dist-info at its top level, such as a zipapp: the archive’s own files, the project’s distribution, and every wheel it bundles, as a file or unpacked, described as the wheel’s SBOM describes them. Options come from [tool.python-sbom].
python-sbom archive [-h] [--root DIR] [--commit SHA] [--build-env DIR]
[--content-provider MODULE:ATTRIBUTE] [--build-script PATH]
[--output FILE] [--embed]
ARCHIVE
archive positional arguments¶
ARCHIVE- archive to describe
archive options¶
--rootDIR- project directory of the artifact (default: current directory)--commitSHA- source revision to record, for an artifact built from an sdist--build-envDIR- site-packages directory of the environment that built the artifact; repeat it per directory (default: this interpreter’s)--content-providerMODULE:ATTRIBUTE- content provider, overriding the content-provider option--build-scriptPATH- script, relative to the project, that built the archive; repeat it per script--outputFILE- SBOM file to write (default: <archive>.cdx.json next to it)--embed- also add the SBOM to the archive, at its top level as <archive>.cdx.json
spdx¶
Render a CycloneDX JSON SBOM, such as one python-sbom wrote, as an SPDX 2.3 JSON document. It checks only the fields the rendering reads, so it needs no extra; python-sbom validate checks the whole document.
python-sbom spdx [-h] SOURCE TARGET
spdx positional arguments¶
spdx options¶
validate¶
Check every CycloneDX SBOM a wheel or archive holds against the CycloneDX 1.6 schema; for one python-sbom wrote, also its serial number, references, SPDX rendering and, with --allow-license, the licenses of what it ships. Needs the validate extra: python-sbom[validate].
python-sbom validate [-h] [--allow-license SPDX-ID] [--max-components N] PATH [PATH ...]
validate positional arguments¶
PATH- wheel, archive, or directory holding wheels
validate options¶
--allow-licenseSPDX-ID- SPDX license id shipped components may use; repeat it per id, leave it out to skip the license policy--max-componentsN- reject an SBOM listing more than N components, nested ones included, or larger than 1 MiB plus 1 KiB per component, without checking it further, which bounds the work an untrusted SBOM can ask for (default: 100000)