Use it with scikit-build-core¶
scikit-build-core has no plugin interface, so its projects get the SBOM through the wrapper backend.
Make python_sbom.backend the project’s backend, keep scikit-build-core in the build requirements, and name
scikit_build_core.build in [tool.python-sbom] build-backend:
pyproject.toml¶
[build-system]
build-backend = "python_sbom.backend"
requires = [ "python-sbom>=0.3", "scikit-build-core>=0.11" ]
[project]
name = "greet"
version = "1.0"
description = "says hello"
license = "MIT"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dependencies = [ "packaging>=24" ]
[tool.scikit-build]
wheel.packages = [ "src/greet" ]
[tool.python-sbom]
build-backend = "scikit_build_core.build"
supplier = { name = "You", url = [ "https://github.com/you" ] }
CMakeLists.txt¶
cmake_minimum_required(VERSION 3.15...3.31)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
python_add_library(_greet MODULE src/greet/_greet.c WITH_SOABI)
install(TARGETS _greet DESTINATION greet)
Then build a wheel and check it:
$ python -m build --wheel
$ python-sbom validate dist/
SBOM in greet-1.0-cp315-cp315-linux_x86_64.whl is valid
docs/examples/scikit-build-core holds the whole project. Use it with any other backend describes what the wrapper does with each hook.
Projects that build with hatchling¶
A project built with hatchling and scikit-build-core’s hatch plugin uses Use it with hatchling instead: the python-sbom hook runs next to scikit-build-core’s.