[tool.scikit-build]
Starting fresh with a primarily compiled extension? The standalone scikit_build_core.build backend is still the simplest path.
scikit_build_core.build
[build-system] requires = ["scikit-build-core[hatchling]>=1"] build-backend = "hatchling.build" [project] name = "hatchling_example" version = "0.1.0" [tool.hatch.build.targets.wheel.hooks.scikit-build]
hooks.scikit-build
[hatchling]
tool.hatch.build.targets.wheel.hooks.scikit-build
tool.scikit-build
wheel.cmake
platlib = false
generate
metadata
-C...
CMakeLists.txt
${SKBUILD_HATCHLING}
hatchling ├── pyproject.toml ├── cpp │ ├── CMakeLists.txt │ └── example.c └── src └── hatchling_example └── __init__.py
[tool.hatch.build.targets.wheel.hooks.scikit-build] cmake.source-dir = "cpp" wheel.install-dir = "hatchling_example"
cmake.source-dir
wheel.install-dir
_core
__init__.py
cmake_minimum_required(VERSION 3.15...4.3) project(${SKBUILD_PROJECT_NAME} LANGUAGES C) find_package( Python COMPONENTS Interpreter Development.Module REQUIRED) python_add_library(_core MODULE example.c WITH_SOABI) install(TARGETS _core DESTINATION .)
Exactly what you'd write for the standalone backend.
[build-system] requires = ["scikit-build-core[setuptools]>=1"] build-backend = "scikit_build_core.setuptools.build_meta"
setuptools.build_meta
scikit_build_core.setuptools.build_meta
cmake
ninja
The plugin only activates with a cmake.source-dir setting (or the classic cmake_source_dir keyword in a minimal setup.py):
cmake_source_dir
setup.py
# pyproject.toml (recommended) [tool.scikit-build] cmake.source-dir = "."
# setup.py from setuptools import setup setup(cmake_source_dir=".")
Everything else configures through [tool.scikit-build] as normal.
sdist.inclusion-mode = "explicit"
pip install -e .
editable.mode = "inplace"
-C cmake.build-type=Debug
cmake_args
cmake_install_dir
cmake_install_target