Skip to main content

Hatch SBOM

CI/CD CI - Test Coverage Status CI - Lint CD - Publish
Package PyPI - Version PyPI - Python Version
Meta Hatch project linting - Ruff types - Mypy License - MIT

A Hatchling build hook plugin to automatically generate a Software Bill of Materials (SBOM) during wheel creation.

Usage

To use this plugin, configure your pyproject.toml to require both hatchling (>=1.28.0) and hatch-sbom in your build-system.

For a requirements.txt SBOM:

[build-system]
requires = ["hatchling>=1.28.0", "hatch-sbom[cdx]"]
build-backend = "hatchling.build"

The base install is minimal. Install extras only for the backend used by your selected source:

  • requirements, poetry, pipenv, and environment use cyclonedx-py and need hatch-sbom[cdx].
  • uv uses uv export directly and needs hatch-sbom[uv].
  • pdm uses both pdm export and cyclonedx-py, so it needs hatch-sbom[pdm,cdx].

Next, configure the build hook specifically for the wheel target:

[tool.hatch.build.targets.wheel.hooks.sbom]
source = "requirements"
path = "requirements.txt"
format = "json"        # Optional, defaults to "json"
spec-version = "1.6"   # Optional, defaults to "1.6"

Supported Sources

The source field determines how the SBOM is built.

Source Requires Backend Path behavior
requirements hatch-sbom[cdx] cyclonedx-py requirements Optional; defaults to requirements.txt when present.
poetry hatch-sbom[cdx] cyclonedx-py poetry Optional; defaults to the current directory.
pipenv hatch-sbom[cdx] cyclonedx-py pipenv Optional; defaults to the current directory.
environment hatch-sbom[cdx] cyclonedx-py environment Optional; defaults to the current directory.
uv hatch-sbom[uv] uv export Optional; defaults to the current directory. Requires uv.lock.
pdm hatch-sbom[pdm,cdx] pdm export, then cyclonedx-py requirements Optional; defaults to the current directory. Requires pdm.lock.

The uv source only supports json format and CycloneDX 1.5.

Source-Specific Arguments

You can pass extra arguments to the underlying tool (e.g., uv export, pdm export, or cyclonedx-py <source>) by creating a nested table named after the source.

This is useful for passing flags like --without, --no-dev, etc.

For example, to omit the dev and test groups when using Poetry:

[tool.hatch.build.targets.wheel.hooks.sbom.poetry]
without = ["dev", "test"]  # Appends `--without dev --without test`

To include all extras when using uv:

[tool.hatch.build.targets.wheel.hooks.sbom.uv]
all-extras = true  # Appends `--all-extras`

You can use the extra-args key to pass an arbitrary list of raw arguments:

[tool.hatch.build.targets.wheel.hooks.sbom.pipenv]
extra-args = ["--mc-type", "firmware"]

The generated SBOM file (e.g., sbom.cdx.json) will be automatically placed in the .dist-info/sboms/ directory of the resulting wheel.

Metadata

Release files for hatch-sbom 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatch-sbom 0.4.2
File Size Uploaded
hatch_sbom-0.4.2.tar.gz 123.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-sbom 0.4.2
File Interpreter ABI Platform
hatch_sbom-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 136.8 kB

Release files / hatch_sbom-0.4.2.tar.gz

Download URL hatch_sbom-0.4.2.tar.gz
Size 123.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6539360cae31e807be0154a292fea2d842a173b314ed567804044a5b1a7f3ce0
BLAKE2b-256 checksum
How to use checksums
4971d2a5b8ecf6d123f2c3c15ebff5af300702701f59ead3132ea08813acb4bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release files / hatch_sbom-0.4.2-py3-none-any.whl

Download URL hatch_sbom-0.4.2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99060f7a2003a5e42f564ed919512968f0a83288640989ddd31d4b6921570429
BLAKE2b-256 checksum
How to use checksums
07f73dc7691292396ec35490a5f52439b1bc7a058ed4b12c1c6c54c341d01356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page