A next generation Python CMake adaptor and Python API for plugins
See the code[!NOTE]
We have a public Scikit-build community meeting every month! Join us on Google Meet on the third Friday of every month at 12:00 PM ET. Some of our past meeting minutes are available here.
Scikit-build-core is a build backend for Python that uses CMake to build extension modules. It has a simple yet powerful static configuration system in pyproject.toml, and supports almost unlimited flexibility via CMake. It was initially developed to support the demanding needs of scientific users, but can build any sort of package that uses CMake.
Scikit-build-core is a ground-up rewrite of the classic Scikit-build. The key features of scikit-build classic (which is setuptools based) are also present here:
Scikit-build-core was built using Python packaging standards developed after scikit-build (classic) was written. Using it directly provides the following features over classic Scikit-build:
CMAKE_PREFIX_PATHCMAKE_GENERATORbuild-dir)[[tool.dynamic-metadata]] standardscikit-build CLI, including scikit-build init to scaffold a new project.Current requirements:
The recommended interface is the native pyproject builder. Other backends are also available:
[setuptools] extra)[hatchling] extra)[!WARNING]
The setuptools and hatchling backends might move to standalone packages in the future, so depend on them via the
scikit-build-core[setuptools]andscikit-build-core[hatchling]extras to stay protected if they do.
The fastest way to start a new project is scikit-build init (available via
uvx scikit-build-core init as well), which generates a minimal CMake +
scikit-build-core starter project. The pieces are described below.
To use scikit-build-core, add it to your build-system.requires, and specify
the scikit_build_core.build builder as your build-system.build-backend. You
do not need to specify cmake or ninja; scikit-build-core will require them
automatically if the system versions are not sufficient.
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"
[project]
name = "scikit_build_simplest"
version = "0.0.1"
You can (and should) specify the rest of the entries in project, but these are
the minimum to get started.
An example CMakeLists.txt:
cmake_minimum_required(VERSION 3.15...4.4)
project(scikit_build_simplest LANGUAGES C)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
Python_add_library(_module MODULE src/module.c WITH_SOABI)
install(TARGETS _module DESTINATION scikit_build_simplest)
The install(DESTINATION ...) is relative to site-packages, so the _module
extension above lands at scikit_build_simplest/_module.* when the package is
pip installed. Scikit-build-core will backport FindPython from CMake 3.26.1 to
older versions of Python, and will handle PyPy for you if you are building from
PyPy. You will need to install everything you want into the full final path
inside site-packages (so you will usually prefix everything by the package name)
-- including any __init__.py, which CMake can place alongside the extension
with install(FILES src/__init__.py DESTINATION scikit_build_simplest).
The most important optional configuration is this:
[build-system]
requires = ["scikit-build-core>=1.0"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
minimum-version = "build-system.requires"
This will enable scikit-build-core to read your minimum requirement on itself and stay in compatibility mode for that version; if we make changes to defaults in the future, your package will continue to build exactly the same.
The Getting started guide walks through a complete package step by step. More examples are in the tests/packages.
All configuration options can be placed in pyproject.toml, passed via -C in
pip, uv, and build, or set as environment variables. tool.scikit-build is used
in toml, skbuild. for -C options, or SKBUILD_* for environment variables.
For a full reference and explanation of the variables see the online documentation
A quick summary and some defaults are listed below:
| Option | Default | Description |
|---|---|---|
metadata | {} | List dynamic metadata fields and hook locations in this table. |
env | {} | A table of environment variables to set for the CMake subprocesses. |
strict-config | true | Strictly check all config options. |
experimental | false | Enable early previews of features not finalized yet. |
minimum-version | "1.1" (current version) | If set, this will provide a method for backward compatibility. |
build-dir | "" | The CMake build directory. Defaults to a unique temporary directory. |
cmake| Option | Default | Description |
|---|---|---|
cmake.version | "" | The versions of CMake to allow as a python-compatible specifier. |
cmake.args | [] | A list of args to pass to CMake when configuring the project. |
cmake.define | {} | A table of defines to pass to CMake when configuring the project. Additive. |
cmake.build-type | "Release" | The build type to use when building the project. |
cmake.source-dir | "." | The source directory to use when building the project. |
cmake.fresh | false | Discard any cached CMake configuration and configure from scratch, like cmake --fresh. |
cmake.python-hints | true | Do not pass the current environment's python hints such as Python_EXECUTABLE. |
ninja| Option | Default | Description |
|---|---|---|
ninja.version | ">=1.5" | The versions of Ninja to allow. |
ninja.make-fallback | true | Use Make as a fallback if a suitable Ninja executable is not found. |
logging| Option | Default | Description |
|---|---|---|
logging.level | "WARNING" | The logging level to display. (choices: NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL) |
sdist| Option | Default | Description |
|---|---|---|
sdist.include | [] | Files to include in the SDist even if they are skipped by default. Supports gitignore syntax. |
sdist.exclude | [] | Files to exclude from the SDist even if they are included by default. Supports gitignore syntax. |
sdist.inclusion-mode | "default" ("classic") | Method to use to compute the files to include and exclude. (choices: classic, default, manual, explicit) |
sdist.reproducible | true | Try to build a reproducible distribution. |
sdist.cmake | false | If set to True, CMake will be run before building the SDist. |
sdist.force-include | {} | Force-include files into the SDist. |
sdist.resolve-symlinks | "all" | Which symlinks to resolve in the SDist, storing the target's contents instead. (choices: all, external, none, classic, error) |
wheel| Option | Default | Description |
|---|---|---|
wheel.packages | ["src/<package>", "python/<package>", "<package>"] | A list of packages to auto-copy into the wheel. |
wheel.py-api | "" | The Python version tag used in the wheel file. |
wheel.expand-macos-universal-tags | false | Fill out extra tags that are not required. |
wheel.install-dir | "" | The CMake install prefix relative to the platlib wheel path. |
wheel.license-files | "" | A list of license files to include in the wheel. Supports glob patterns. |
wheel.cmake | true | Run CMake as part of building the wheel. |
wheel.platlib | "" | Target the platlib or the purelib. |
wheel.exclude | [] | A set of patterns to exclude from the wheel. |
wheel.build-tag | "" | The build tag to use for the wheel. If empty, no build tag is used. |
wheel.force-include | {} | Force-include files into the wheel. |
wheel.reproducible | false | Try to build a reproducible wheel. |
backport| Option | Default | Description |
|---|---|---|
backport.find-python | "3.26.1" | If CMake is less than this value, backport a copy of FindPython. |
editable| Option | Default | Description |
|---|---|---|
editable.mode | "redirect" | Select the editable mode to use. (choices: redirect, inplace) |
editable.verbose | true | Turn on verbose output for the editable mode rebuilds. |
editable.rebuild | false | Rebuild the project when the package is imported. |
editable.rebuild-dir | "" | Install editables into this persistent tree instead of the wheel. |
build| Option | Default | Description |
|---|---|---|
build.tool-args | [] | Extra args to pass directly to the builder in the build step. |
build.targets | [] | The build targets to use when building the project. |
build.verbose | false | Verbose printout when building. |
build.requires | [] | Additional build-system.requires. |
install| Option | Default | Description |
|---|---|---|
install.components | [] | The components to install. |
install.targets | [] | Build targets to run during the install step via cmake --build --target. |
install.strip | true | Whether to strip the binaries. |
generate[]| Option | Default | Description |
|---|---|---|
generate[].path | "" | The path (relative to platlib) for the file to generate. |
generate[].template | "" | The template string to use for the file. |
generate[].template-path | "" | The path to the template file. If empty, a template must be set. |
generate[].location | "install" | The place to put the generated file. (choices: install, build, source) |
messages| Option | Default | Description |
|---|---|---|
messages.after-failure | "" | A message to print after a build failure. |
messages.after-success | "" | A message to print after a successful build. |
search| Option | Default | Description |
|---|---|---|
search.site-packages | true | Add the python build environment site_packages folder to the CMake prefix paths. |
Most CMake environment variables should be supported, and CMAKE_ARGS can be
used to set extra CMake args. ARCHFLAGS is used to specify macOS universal2 or
cross-compiles, just like setuptools.
You can also specify [[tool.scikit-build.overrides]] to customize values for
different systems. See the docs for details.
Scikit-build-core is a binary build backend. There are also other binary build backends:
cmake.* entrypoints, but
folder-based).If you don't need a binary build, you don't need to use a binary build backend! There are some very good Python build backends; we recommend hatchling as a good balance between good defaults for beginners and good support for advanced use cases. This is the tool scikit-build-core itself uses.
Support for this work was provided by NSF grant OAC-2209877. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
2,420 followers · starred Feb 2024
325 followers · starred Mar 2023
1,589 followers · starred Oct 2024
12,865 followers · starred Aug 2025
A next generation Python CMake adaptor and Python API for plugins
See the code[!NOTE]
We have a public Scikit-build community meeting every month! Join us on Google Meet on the third Friday of every month at 12:00 PM ET. Some of our past meeting minutes are available here.
Scikit-build-core is a build backend for Python that uses CMake to build extension modules. It has a simple yet powerful static configuration system in pyproject.toml, and supports almost unlimited flexibility via CMake. It was initially developed to support the demanding needs of scientific users, but can build any sort of package that uses CMake.
Scikit-build-core is a ground-up rewrite of the classic Scikit-build. The key features of scikit-build classic (which is setuptools based) are also present here:
Scikit-build-core was built using Python packaging standards developed after scikit-build (classic) was written. Using it directly provides the following features over classic Scikit-build:
CMAKE_PREFIX_PATHCMAKE_GENERATORbuild-dir)[[tool.dynamic-metadata]] standardscikit-build CLI, including scikit-build init to scaffold a new project.Current requirements:
The recommended interface is the native pyproject builder. Other backends are also available:
[setuptools] extra)[hatchling] extra)[!WARNING]
The setuptools and hatchling backends might move to standalone packages in the future, so depend on them via the
scikit-build-core[setuptools]andscikit-build-core[hatchling]extras to stay protected if they do.
The fastest way to start a new project is scikit-build init (available via
uvx scikit-build-core init as well), which generates a minimal CMake +
scikit-build-core starter project. The pieces are described below.
To use scikit-build-core, add it to your build-system.requires, and specify
the scikit_build_core.build builder as your build-system.build-backend. You
do not need to specify cmake or ninja; scikit-build-core will require them
automatically if the system versions are not sufficient.
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"
[project]
name = "scikit_build_simplest"
version = "0.0.1"
You can (and should) specify the rest of the entries in project, but these are
the minimum to get started.
An example CMakeLists.txt:
cmake_minimum_required(VERSION 3.15...4.4)
project(scikit_build_simplest LANGUAGES C)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
Python_add_library(_module MODULE src/module.c WITH_SOABI)
install(TARGETS _module DESTINATION scikit_build_simplest)
The install(DESTINATION ...) is relative to site-packages, so the _module
extension above lands at scikit_build_simplest/_module.* when the package is
pip installed. Scikit-build-core will backport FindPython from CMake 3.26.1 to
older versions of Python, and will handle PyPy for you if you are building from
PyPy. You will need to install everything you want into the full final path
inside site-packages (so you will usually prefix everything by the package name)
-- including any __init__.py, which CMake can place alongside the extension
with install(FILES src/__init__.py DESTINATION scikit_build_simplest).
The most important optional configuration is this:
[build-system]
requires = ["scikit-build-core>=1.0"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
minimum-version = "build-system.requires"
This will enable scikit-build-core to read your minimum requirement on itself and stay in compatibility mode for that version; if we make changes to defaults in the future, your package will continue to build exactly the same.
The Getting started guide walks through a complete package step by step. More examples are in the tests/packages.
All configuration options can be placed in pyproject.toml, passed via -C in
pip, uv, and build, or set as environment variables. tool.scikit-build is used
in toml, skbuild. for -C options, or SKBUILD_* for environment variables.
For a full reference and explanation of the variables see the online documentation
A quick summary and some defaults are listed below:
| Option | Default | Description |
|---|---|---|
metadata | {} | List dynamic metadata fields and hook locations in this table. |
env | {} | A table of environment variables to set for the CMake subprocesses. |
strict-config | true | Strictly check all config options. |
experimental | false | Enable early previews of features not finalized yet. |
minimum-version | "1.1" (current version) | If set, this will provide a method for backward compatibility. |
build-dir | "" | The CMake build directory. Defaults to a unique temporary directory. |
cmake| Option | Default | Description |
|---|---|---|
cmake.version | "" | The versions of CMake to allow as a python-compatible specifier. |
cmake.args | [] | A list of args to pass to CMake when configuring the project. |
cmake.define | {} | A table of defines to pass to CMake when configuring the project. Additive. |
cmake.build-type | "Release" | The build type to use when building the project. |
cmake.source-dir | "." | The source directory to use when building the project. |
cmake.fresh | false | Discard any cached CMake configuration and configure from scratch, like cmake --fresh. |
cmake.python-hints | true | Do not pass the current environment's python hints such as Python_EXECUTABLE. |
ninja| Option | Default | Description |
|---|---|---|
ninja.version | ">=1.5" | The versions of Ninja to allow. |
ninja.make-fallback | true | Use Make as a fallback if a suitable Ninja executable is not found. |
logging| Option | Default | Description |
|---|---|---|
logging.level | "WARNING" | The logging level to display. (choices: NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL) |
sdist| Option | Default | Description |
|---|---|---|
sdist.include | [] | Files to include in the SDist even if they are skipped by default. Supports gitignore syntax. |
sdist.exclude | [] | Files to exclude from the SDist even if they are included by default. Supports gitignore syntax. |
sdist.inclusion-mode | "default" ("classic") | Method to use to compute the files to include and exclude. (choices: classic, default, manual, explicit) |
sdist.reproducible | true | Try to build a reproducible distribution. |
sdist.cmake | false | If set to True, CMake will be run before building the SDist. |
sdist.force-include | {} | Force-include files into the SDist. |
sdist.resolve-symlinks | "all" | Which symlinks to resolve in the SDist, storing the target's contents instead. (choices: all, external, none, classic, error) |
wheel| Option | Default | Description |
|---|---|---|
wheel.packages | ["src/<package>", "python/<package>", "<package>"] | A list of packages to auto-copy into the wheel. |
wheel.py-api | "" | The Python version tag used in the wheel file. |
wheel.expand-macos-universal-tags | false | Fill out extra tags that are not required. |
wheel.install-dir | "" | The CMake install prefix relative to the platlib wheel path. |
wheel.license-files | "" | A list of license files to include in the wheel. Supports glob patterns. |
wheel.cmake | true | Run CMake as part of building the wheel. |
wheel.platlib | "" | Target the platlib or the purelib. |
wheel.exclude | [] | A set of patterns to exclude from the wheel. |
wheel.build-tag | "" | The build tag to use for the wheel. If empty, no build tag is used. |
wheel.force-include | {} | Force-include files into the wheel. |
wheel.reproducible | false | Try to build a reproducible wheel. |
backport| Option | Default | Description |
|---|---|---|
backport.find-python | "3.26.1" | If CMake is less than this value, backport a copy of FindPython. |
editable| Option | Default | Description |
|---|---|---|
editable.mode | "redirect" | Select the editable mode to use. (choices: redirect, inplace) |
editable.verbose | true | Turn on verbose output for the editable mode rebuilds. |
editable.rebuild | false | Rebuild the project when the package is imported. |
editable.rebuild-dir | "" | Install editables into this persistent tree instead of the wheel. |
build| Option | Default | Description |
|---|---|---|
build.tool-args | [] | Extra args to pass directly to the builder in the build step. |
build.targets | [] | The build targets to use when building the project. |
build.verbose | false | Verbose printout when building. |
build.requires | [] | Additional build-system.requires. |
install| Option | Default | Description |
|---|---|---|
install.components | [] | The components to install. |
install.targets | [] | Build targets to run during the install step via cmake --build --target. |
install.strip | true | Whether to strip the binaries. |
generate[]| Option | Default | Description |
|---|---|---|
generate[].path | "" | The path (relative to platlib) for the file to generate. |
generate[].template | "" | The template string to use for the file. |
generate[].template-path | "" | The path to the template file. If empty, a template must be set. |
generate[].location | "install" | The place to put the generated file. (choices: install, build, source) |
messages| Option | Default | Description |
|---|---|---|
messages.after-failure | "" | A message to print after a build failure. |
messages.after-success | "" | A message to print after a successful build. |
search| Option | Default | Description |
|---|---|---|
search.site-packages | true | Add the python build environment site_packages folder to the CMake prefix paths. |
Most CMake environment variables should be supported, and CMAKE_ARGS can be
used to set extra CMake args. ARCHFLAGS is used to specify macOS universal2 or
cross-compiles, just like setuptools.
You can also specify [[tool.scikit-build.overrides]] to customize values for
different systems. See the docs for details.
Scikit-build-core is a binary build backend. There are also other binary build backends:
cmake.* entrypoints, but
folder-based).If you don't need a binary build, you don't need to use a binary build backend! There are some very good Python build backends; we recommend hatchling as a good balance between good defaults for beginners and good support for advanced use cases. This is the tool scikit-build-core itself uses.
Support for this work was provided by NSF grant OAC-2209877. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
2,420 followers · starred Feb 2024
325 followers · starred Mar 2023
1,589 followers · starred Oct 2024
12,865 followers · starred Aug 2025