Generate SPDX 3 SBOMs for Python projects and AI models with native Hatchling build-hook support.
pip install pitloom==0.24.0 Copy PIP instructions
Automated transparency, woven from the ground up.
Pitloom automates the generation of SPDX 3-compliant software bills of materials (SBOMs) for Python applications and AI models.
It extracts metadata directly from Python projects, whether declared in the standard [project] table (Flit, Hatchling, PDM, uv_build and others), Poetry's [tool.poetry], or setuptools' setup.cfg and setup.py, and from leading AI model formats, including PyTorch, ONNX, Safetensors, GGUF, and fastText.
With native Hatchling integration and an official GitHub Action, Pitloom embeds SBOMs directly into your wheel distribution under .dist-info/sboms, following the PyPA Package Installation Metadata specification (PEP 770) -- offering software supply chain transparency without disrupting the build pipeline.
pip install pitloom licenseid update --source packaged # once: enables LICENSE-file matching loom project . # SBOM for the Python project in the current dir Without the LicenseID database, a declared licence is still read, but a LICENSE file is not matched.
Extras enable more metadata extraction (see CONTRIBUTING.md for the dev install):
pip install "pitloom[ai]" # AI model files and Hugging Face Hub pip install "pitloom[content-type]" # content type detection (Magika) pip install "pitloom[validate]" # SPDX 3 schema/SHACL validation Usage Pitloom produces the same kind of SBOM for the same target on every surface. Pick the one that fits how you work:
loom project . # Source SBOM of a project loom wheel dist/pkg-1.0-py3-none-any.whl # Analyzed SBOM of a built wheel loom env -o env.spdx3.json # Deployed SBOM of the installed environment loom model path/to/model.safetensors # Analyzed SBOM of one AI model file loom generate . -o sbom.spdx3.json # detect the target type (-o is required) Works with remote resources too:
loom project https://gitlab.com/group/project loom wheel https://pypi.org/project/pitloom/0.24.0/ # The wheel PyPI holds for this Python loom model https://github.com/org/repo/blob/main/m.keras loom model https://huggingface.co/Qwen/Qwen3.8-27B # Or just Qwen/Qwen3.8-27B -o FILE sets the output path. The per-file inventory (file list, hashes) follows the project's build backend: accurate for Flit-core, Hatchling, PDM-backend, Poetry and setuptools, and for uv_build with --allow-build; other backends fall back to a heuristic with a WARNING:. Lock files (pylock.toml, uv.lock, poetry.lock, pdm.lock, Pipfile.lock, pinned requirements.txt) are read automatically; opt out with --no-use-lockfile. AI model formats: GGUF, ONNX, Safetensors, PyTorch (.pt/.pth, .pt2), Keras, HDF5, NumPy, fastText, CRFsuite; a file, a folder holding one model, or a Git URL of either.
AI-model gaps (licence, datasets) can be filled from a README or model card's YAML frontmatter, opt in with --enrich, or standalone as a mergeable fragment:
loom enrich path/to/model.safetensors -o model.enrich.spdx3.json See Command line for per-command detail, SBOM from a Git URL for repository URLs, SBOM from a PyPI URL for PyPI project pages, Wheel SBOMs for embed-wheel, verify-wheel and validate-wheel, and SBOM fragments for merging.
Embeds an SBOM at .dist-info/sboms/ - .spdx3.json in every wheel built (PEP 770, compact canonical JSON). Needs Hatchling 1.29.0+:
[build-system] requires = ["hatchling>=1.29.0", "pitloom>=0.24.0"] build-backend = "hatchling.build" [tool.hatch.build.hooks.pitloom] enabled = true # set to false to skip SBOM generation Basename, fragments, creators and provenance are set under [tool.pitloom]; see the hook page and Configuration.
from pathlib import Path from pitloom.core.creation import CreationMetadata, Creator from pitloom.assemble import generate, generate_project_sbom # Detects the target type generate( target=Path("/path/to/project"), output_path=Path("sbom.spdx3.json"), creation_metadata=CreationMetadata(creators=[Creator(name="Your Name")]), ) # Or a target-specific generator generate_project_sbom( project_target=Path("/path/to/project"), output_path=Path("sbom.spdx3.json"), ) pitloom.assemble also has generate_wheel_sbom(), generate_model_sbom() and generate_env_sbom().
Tracking decorator. Annotate a training or evaluation script, as a decorator or a context manager, to write an SBOM fragment that Pitloom merges at build time. Use set_model for a model you produce, use_model for one you consume:
from pitloom import loom @loom.run(output_file="fragments/sentiment_model.json") def train_model(): loom.set_model("sentiment-clf") loom.add_dataset("imdb-reviews", dataset_type="text") # ... training logic ... @loom.run(output_file="fragments/sentiment_eval.json") def evaluate_model(): loom.use_model("sentiment-clf") loom.add_dataset("imdb-test-set", dataset_type="text") # ... evaluation logic ... See Python API for lineage between several datasets in one run, and Loom ID registry for stable ids across fragments.
SBOM generation in CI, for any Python build backend:
- uses: actions/setup-python@v7 with: python-version: "3.x" - uses: bact/pitloom@v0.24.0 Add embed-wheel: "dist/*.whl" to embed the SBOM into built wheels. See GitHub Action for inputs, outputs and recipes.
skills/sbom-generate/, skills/sbom-enrich/ and skills/sbom-validate/ are Agent Skills for Claude Code, the Claude Agent SDK and other compatible clients. Ask in plain language ("generate an SBOM for this project") or invoke one: /sbom-generate [target], /sbom-enrich [sbom-file], /sbom-validate [sbom-file]. Generate first; sbom-enrich needs an existing Pitloom SBOM.
For Claude Code, install all three as a plugin from this repository:
/plugin marketplace add bact/pitloom /plugin install pitloom@pitloom The Skills are then namespaced, e.g. /pitloom:sbom-generate. See Agent Skills (install into other clients) and Claude Code plugin.
git clone https://github.com/bact/sentimentdemo.git loom project sentimentdemo The generated SBOM includes project metadata, dependencies (extras included) with version constraints, SPDX relationships, creator/creation info and per-field metadata provenance. See a more complete example in examples/.
Pitloom's Hatchling build hook writes Pitloom's SBOM into its wheel, at .dist-info/sboms/ - .spdx3.json (PEP 770). The release build installs the content-type extra, so every non-empty file's content type is detected by magika.
The same three files also have a GitHub artifact attestation (build provenance), kept by GitHub, not attached to the release.
To check a download ( is the wheel, the sdist or the SBOM; the Sigstore bundle path defaults to .sigstore.json, --bundle overrides it):
loom verify-wheel .whl pip install sigstore # download and .sigstore.json from the release into one directory python -m sigstore verify github \ --cert-identity https://github.com/bact/pitloom/.github/workflows/pypi-publish.yml@refs/tags/v gh attestation verify -R bact/pitloom \ --signer-workflow bact/pitloom/.github/workflows/pypi-publish.yml \ --source-ref refs/tags/v Licence Source code: Apache License 2.0. Documentation: Creative Commons Zero 1.0 Universal (CC0-1.0). Test fixture AI models: individually licensed (Apache-2.0, CC0-1.0, or MIT); see tests/fixtures/README.md. Source repository only -- not included in distribution packages. Citation If you use this software, please cite it as follows:
Suriyawongkul, A. (2026). Pitloom - SBOM generator for AI models and Python projects (Version 0.24.0) [Computer software]. https://doi.org/10.5281/zenodo.19246283
@software{Suriyawongkul_Pitloom_SBOM_2026, author = {Suriyawongkul, Arthit}, doi = {10.5281/zenodo.19246283}, month = nov, title = {{Pitloom - SBOM generator for AI models and Python projects}}, url = {https://github.com/bact/pitloom}, version = {0.24.0}, year = {2026} } Name A pit loom is a traditional handloom built into a ground-level pit to house its internal mechanisms and the weaver's legs. This "grounded" design provides stability and precision during the weaving process.
We use the loom as a metaphor for the tool's function: it weaves disparate threads of metadata into a cohesive SBOM, creating a transparent, structured "fabric" for the software build.
Both files in this release have provenance metadata.
ai build content-type fasttext gguf hdf5 huggingface-hub numpy onnx pytorch safetensors validate
ai-sbom aibom bom gguf hatchling metadata onnx pep-770 poetry provenance safetensors sbom software-bill-of-materials software-supply-chain-security spdx supply-chain-security transparency
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Both files in this release have been uploaded with provenance metadata.
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.




