Registry / devops / scikit-build-core

scikit-build-core

JSON →
library0.12.2pypypiunverified

scikit-build-core is a modern, PEP 517/660 compliant build backend for Python projects that use CMake to build native extensions. It streamlines the integration of C, C++, or Fortran code with Python packaging, handling everything from project configuration to wheel and sdist generation. The current version is 0.12.2, with a fairly active release cadence, typically releasing minor bugfix or feature updates every few weeks.

pip install scikit-build-core
INSTALL
IMPORT
SIG · SCIKIT-BUILD-CORE
S
scikit-build-core
devopspythonv0.12.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

To use scikit-build-core, you primarily configure your project via `pyproject.toml`. This minimal example demonstrates how to set up `pyproject.toml` to declare `scikit-build-core` as the build backend, alongside a basic `CMakeLists.txt` and a dummy C++ source file. The Python `__init__.py` shows where the native library would typically be loaded. After running `python -m build`, `scikit-build-core` invokes CMake to build your native extension and then packages it into a wheel. You'll need CMake and a C++ compiler installed on your system to run this.

mkdir my_cmake_project cd my_cmake_project # pyproject.toml cat <<EOF > pyproject.toml [build-system] requires = ["scikit-build-core>=0.12.0", "cmake>=3.15"] build-backend = "scikit_build_core.build" [project] name = "my_package" version = "0.1.0" authors = [ { name="Your Name", email="you@example.com" }, ] description = "A minimal example with scikit-build-core" readme = "README.md" requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] [tool.scikit-build] cmake.minimum-version = "3.15" EOF # CMakeLists.txt cat <<EOF > CMakeLists.txt cmake_minimum_required(VERSION 3.15...3.27) project(my_package LANGUAGES CXX) add_library(mylib SHARED mylib.cpp) install(TARGETS mylib DESTINATION .) EOF # mylib.cpp mkdir -p src cat <<EOF > src/mylib.cpp #include <iostream> extern "C" void greet() { std::cout << "Hello from C++!" << std::endl; } EOF # my_package/__init__.py mkdir -p my_package cat <<EOF > my_package/__init__.py import os import sys from pathlib import Path # Find the built native library (e.g., _mylib.so, _mylib.pyd) # This is a common pattern, but scikit-build-core can also inject helpers. # For a proper package, you'd typically use `from . import _mylib` # assuming the native library is packaged correctly. def _load_native_library(): # This simple example assumes the library is in the package root after install # In a real scenario, use proper packaging tools or scikit-build-core's # built-in module finder to locate and load. # For demonstration, we'll simulate direct loading. try: # On Linux/macOS, it's typically 'libmylib.so' or 'libmylib.dylib' # On Windows, it's 'mylib.dll' or '_mylib.pyd' if sys.platform == 'win32': _mylib = Path(__file__).parent / 'mylib.dll' # Or '_mylib.pyd' elif sys.platform == 'darwin': _mylib = Path(__file__).parent / 'libmylib.dylib' else: _mylib = Path(__file__).parent / 'libmylib.so' # This simple example doesn't actually load the C++ library # for direct python binding calls, as that requires pybind11/nanobind. # The greet() function below will just print a Python message. print(f"[my_package] Simulating loading native library: {_mylib.name}") except Exception as e: print(f"[my_package] Could not load native library: {e}") _load_native_library() def greet(): print("Hello from Python via my_package!") EOF pip install build python -m build pip install dist/*.whl --force-reinstall python -c "from my_package import greet; greet()"
scikit-build-core --version
Debug
Known issues
breakingPython 3.7 support has been removed since version 0.11.0. Projects requiring Python 3.7 must pin `scikit-build-core<0.11.0`.
fix
Upgrade your project's Python version to 3.8 or newer, or pin `scikit-build-core` to a version prior to 0.11.0.
affects: >=0.11.0
gotchaThe default `sdist.inclusion-mode` changed in 0.12.0 from 'classic' to a new mode that no longer traverses ignored directories unless files are explicitly allowed. This can affect which files are included in your source distributions (sdist).
fix
Review your sdist content after upgrading. If you rely on files in ignored directories being included, you might need to adjust your `sdist.include` configuration or explicitly set `sdist.inclusion-mode = "classic"` in `pyproject.toml`.
affects: >=0.12.0
breakingPyPI no longer accepts non-normalized SDist names. `scikit-build-core` versions >=0.12.2 now always normalize SDist names, even if `minimum-version` is set to 0.4 or older. Projects with older `minimum-version` settings should still update their `minimum-version` to explicitly support this change and avoid future issues.
fix
Ensure your `pyproject.toml` has `[tool.scikit-build]` and `minimum-version` is set to `0.12` or higher to explicitly opt into modern behavior and avoid potential future PyPI upload rejections.
affects: >=0.12.2 (SDist generation), <0.12.2 (PyPI upload)
gotchaPython 3.13.4 on Windows is known to have issues with certain build processes. `scikit-build-core` versions >=0.11.5 will warn about this specific Python version.
fix
Avoid using Python 3.13.4 on Windows for building projects with `scikit-build-core`. Use a different Python 3.13.x version or an earlier/later stable release.
affects: Python 3.13.4 on Windows (specific runtime)
gotcha`scikit-build-core` requires CMake and a compatible C/C++ compiler toolchain to be installed and available in the system's PATH. This is not managed by pip.
fix
Install CMake and a suitable C/C++ compiler (e.g., GCC, Clang, MSVC) on your system. For `build-system.requires` in `pyproject.toml`, it's recommended to include `cmake>=X.Y` (where X.Y is your minimum required CMake version) to ensure the build environment explicitly checks for CMake.
affects: *
Errors
Common errors & fixes
scikit_build_core.errors.ScikitBuildError: CMake executable not found.
CMake is either not installed on your system or not discoverable in the system's PATH.
fix
Install CMake from cmake.org or your system's package manager (e.g., `apt install cmake`, `brew install cmake`) and ensure it's in your PATH.
ERROR Backend 'scikit_build_core.build' could not be loaded
The `build-system.build-backend` entry in your `pyproject.toml` is incorrect, misspelled, or `scikit-build-core` is not installed.
fix
Ensure `pyproject.toml` correctly specifies `build-system.build-backend = "scikit_build_core.build"` and `pip install scikit-build-core`.
ERROR Command '['cmake', ...]']' returned non-zero exit status 1.
An underlying CMake configuration, build, or compilation step failed due to issues in `CMakeLists.txt`, source code, or missing dependencies.
fix
Examine the detailed output preceding this error to identify the specific CMake or compiler error, then debug your `CMakeLists.txt` or C/C++/Fortran source files.
ModuleNotFoundError: No module named 'scikit_build_core'
The `scikit-build-core` package, specified as the build backend, is not installed in the Python environment where the build command is being executed.
fix
Install `scikit-build-core` in your build environment using `pip install scikit-build-core` (or `pip install build scikit-build-core` if using the `build` package).
Upgrade
Version history
0.12.2latest on PyPI · released Mar 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
1
Resources
scikit-build-core — pip install scikit-build-core · libregistry