feat: Add PEP 770 SBOM files support (wheel.sbom-files setting)#1300
feat: Add PEP 770 SBOM files support (wheel.sbom-files setting)#1300andife wants to merge 5 commits into
Conversation
- Add wheel.sbom-files configuration option for including SBOM files in wheels - SBOM files are copied to *.dist-info/sboms/ directory per PEP 770 - Support for override inheritance via tool.scikit-build.overrides - Validate SBOM file existence at build time - Add comprehensive tests for settings parsing, overrides, and wheel output
|
Is there really any change needed here to support PEP 770? Can't we just use the existing |
Indeed that. Afaik there is no standard on CMake side to define and install sboms, if it were, we could automate it in some form. The current form is only to support static-file sboms, which might be fine for some cases, but it does not cover what the actual CMake state was, e.g. did Coming from the other side, I do not see a specific format that the sboms should have. That we then enforce. And what are the default values to provide? Doesn't this need to be present for |
Description
Implements PEP 770 – Software Bill of Materials (SBOM) support for scikit-build-core wheels. Users can include SBOM files in their wheel distributions via the
wheel.sbom-filesconfiguration option. Files are copied into the*.dist-info/sboms/directory, format-agnostic (SPDX and CycloneDX both work).Changes
sbom_files: Optional[List[str]] = NoneinWheelSettings, with override inheritance support (none/append/prepend)wheel.sbom-filesarray property + override inheritance wiring*.dist-info/sboms/; raisesFileNotFoundErrorfor missing filesdocs/reference/configs.mdentry, mirrorswheel.license-filesstyletests/test_pyproject_pep770.py, parametrized over SPDX and CycloneDXKey design decision: copy timing
SBOM files are copied after
builder.install(), not at settings-load time. This means a CMake target can generate the SBOM file into the build directory andwheel.sbom-filescan point to that path — the file will exist by the time the check runs.This was motivated by looking at how onnx/onnx implements PEP 770: they generate a CycloneDX SBOM dynamically from
FetchContent_Declareblocks inCMakeLists.txtduring the build. With a pre-CMake placement that workflow would have failed withFileNotFoundError.Discussion points
1. The
evidence.occurrencesgaponnx annotates each SBOM component with
evidence.occurrences— the paths of the compiled.so/.pydbinaries that contain the statically-linked dependency. This annotation only makes sense after CMake installs the binaries intowheel_dirs. The current implementation has no hook betweenbuilder.install()andWheelWriterwhere user code could inspectwheel_dirsand mutate the SBOM.For onnx's specific case this is workable (the binary name is known at configure time, so CMake can write a fully-annotated SBOM directly). But the general pattern — inspect what actually landed in the wheel, then annotate — would require a post-install hook. Should scikit-build-core expose one?
2. SBOM generation as a first-class concern
Both hatchling (
initialize()hook) and the onnx approach (custombdist_wheelsubclass) treat SBOM generation as part of the build, not just inclusion of pre-existing files. A futurewheel.post-installhook receivingwheel_dirswould let projects generate or annotate SBOMs with full knowledge of the wheel contents, which is what PEP 770'sevidencefields are designed for.3.
[project]table standardisationThere is ongoing discussion about whether
sbom-filesshould live in the[project]table (likelicense-filesin PEP 639) rather than in tool-specific sections. This is deferred pending PEP 808 (dynamic metadata). The current[tool.scikit-build.wheel]placement is consistent with how hatchling handles it today.