Repository navigation
✨ feat(sbom): link and check other tools' SBOMs - #8
Merged
Merged
Conversation
Documentation build overview
24 files changed ·
|
Every backend gets an example project under docs/examples and a tox environment of its own, so tox r -e maturin builds and checks just that project and tox r -m examples runs all of them. Each test replays the session the docs show and compares python-sbom's output with it, so the docs fail CI when they drift. CI runs every example on Linux and delocate on macOS.
The backend guides move under how-to/backends, one page per backend, and every page includes its configuration and session from the example projects instead of inline copies. The validate guide now says which checks an SBOM another tool wrote gets.
gaborbernat
marked this pull request as ready for review
November 9, 2026 23:15
gaborbernat
added a commit
to tox-dev/tox
that referenced
this pull request
Nov 10, 2026
A labeled factor value that contains a dash, such as `flit-core`,
generated its environment, but `{factor:label}` inside that environment
resolved to the wrong value. With `factors = [{backend = ["flit",
"flit-core"]}]`, `build-flit-core` substituted `flit`; with no shorter
value to fall back on, it substituted the default, which is empty unless
set. tox raised no error either way. I hit this turning per-backend
environments into one `env_base` template in
[tox-dev/python-sbom#8](tox-dev/python-sbom#8),
where `flit-core` had to become `flit_core`. 🐛
The cause was in
[`replace_factor`](https://github.com/tox-dev/tox/blob/5fc90aaaff3ce80c0d004c8bd3d46c29f480c2d9/src/tox/config/loader/replacer.py#L1179-L1183):
it split the environment name on `-` and looked each value up among the
single segments, so a value spanning two segments never matched. The
substitution now matches a value as a run of consecutive segments of the
name, and when several values match, the longest wins, so `flit-core`
beats `flit`. Values without a dash resolve as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wheels built with maturin or repaired with auditwheel already carry an SBOM of their own: maturin lists the Rust crates, auditwheel the system libraries it bundled. python-sbom's SBOM sat next to them without naming them, and
python-sbom validateskipped maturin's.cyclonedx.jsonfile, reporting "no SBOM found" on a wheel that held one. 🔗Now the SBOM python-sbom writes links to every other file in the wheel's
.dist-info/sboms/directory, so a scanner reading it can find the Rust crates or bundled libraries too.validatechecks maturin's file alongside the.cdx.jsonones.The how-to guides gain a backends section with one page per build backend: hatchling, pdm-backend, setuptools, meson-python, scikit-build-core, maturin, flit-core, poetry-core and uv-build, plus the wrapper page for any other. Each page pulls its code from an example project under
docs/examples/, and one tox environment per backend (tox r -e example-maturin, ortox r -m examplesfor all) builds that project and compares python-sbom's output with what the page shows. CI runs them, so a page that drifts from the code fails the check. 📚Architecture
When python-sbom reads a wheel, it now also collects the other files under
sboms/with their SHA-256, leaving out python-sbom's own so a secondembeddoes not link to the copy it replaces. The root component gets one CycloneDXbomexternal reference per file: a URL relative to its own SBOM, which sits in the same directory, plus the file's digest, so a reader can tell whether a later step changed it. The links are format-agnostic, so an SPDX file gets linked too;validatestill checks CycloneDX files alone.Impact
I checked two wheels from PyPI. On peryx 2026.1104.0,
validatenow passes and checks maturin's SBOM. On pipdeptree 4.2.14's musllinux wheel it now fails: theauditwheel.cdx.jsonthat auditwheel 6.8.2 wrote lists the root package twice under the samebom-ref, which CycloneDX forbids, because auditwheel puts the same component in bothmetadata.componentandcomponents. The auditwheel example hits the same failure, and its page says so. I reported it as pypa/auditwheel#750. Until auditwheel fixes it,validatefails on wheels where auditwheel copied in a library and wrote its SBOM.The backend guides moved from
how-to/<backend>tohow-to/backends/<backend>, so links to the old pages on Read the Docs break unless the project adds redirects there. The delocate example runs only on the macOS job, and the test compares output with the wheel tags masked, so the macOS wheel name its page shows is not checked.