{"id":4247,"library":"scikit-build","title":"Scikit-build","description":"Scikit-build is a Python build system that acts as a glue layer between `setuptools` and `CMake` to facilitate the building of CPython C/C++/Fortran/Cython extensions. It is currently at version 0.19.0 and has an active development cycle, with a focus on fixing bugs and improving compatibility. The next generation, `scikit-build-core`, is under active development and offers a more modern, standalone approach without direct reliance on `setuptools`.","status":"active","version":"0.19.0","language":"en","source_language":"en","source_url":"https://github.com/scikit-build/scikit-build","tags":["build-system","c-extensions","fortran","cython","cmake","setuptools","packaging"],"install":[{"cmd":"pip install scikit-build","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Scikit-build (classic) fundamentally integrates with and extends setuptools.","package":"setuptools","optional":false},{"reason":"Required for building C/C++/Fortran/Cython extensions.","package":"cmake","optional":false},{"reason":"Often used as a fast build system generator with CMake.","package":"ninja","optional":true}],"imports":[{"note":"Scikit-build's `setup` function replaces setuptools' `setup` to integrate CMake build logic.","wrong":"from setuptools import setup","symbol":"setup","correct":"from skbuild import setup"}],"quickstart":{"code":"# pyproject.toml\n[build-system]\nrequires = [\"setuptools>=42\", \"scikit-build>=0.13\", \"cmake>=3.18\", \"ninja\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"hello-cpp\"\nversion = \"0.0.1\"\n\n# setup.py\n# This file would be in the same directory as pyproject.toml\n# In a 'hello' subdirectory, you would have a '_hello.cxx' and '__init__.py'\n# In the project root, you would also have a 'CMakeLists.txt'\n\nfrom skbuild import setup\n\nsetup(\n    name=\"hello-cpp\",\n    version=\"0.0.1\",\n    description=\"A minimal C++ extension package using scikit-build\",\n    author='The scikit-build team',\n    license=\"MIT\",\n    packages=['hello'],\n    python_requires=\">=3.8\",\n)\n\n# CMakeLists.txt (example content, not runnable Python):\n# cmake_minimum_required(VERSION 3.18...3.22)\n# project(hello CXX)\n# find_package(PythonExtensions REQUIRED)\n# add_library(_hello MODULE hello/_hello.cxx)\n# python_extension_module(_hello)\n# install(TARGETS _hello LIBRARY DESTINATION hello)","lang":"python","description":"To use scikit-build, you typically define your build requirements in `pyproject.toml`, replace `setuptools.setup` with `skbuild.setup` in your `setup.py`, and provide a `CMakeLists.txt` to describe how to build your C/C++/Fortran/Cython extensions. The `packages` argument in `setup()` helps scikit-build locate your Python modules, which will then be combined with artifacts built by CMake. A simple `hello` subdirectory with `_hello.cxx` (your C++ source) and an empty `__init__.py` is a common starting point."},"warnings":[{"fix":"Upgrade Python environment to 3.8+.","message":"Python 3.7 support was dropped in scikit-build 0.19.0. Ensure your projects target Python 3.8 or newer.","severity":"breaking","affected_versions":"0.19.0+"},{"fix":"Ensure `setuptools` is updated to a compatible version (>=74 is explicitly mentioned for 0.18.1, so likely higher for 0.19.0) and consider upgrading `CMake` to version 4 or newer.","message":"Scikit-build 0.19.0 includes updates for changes in newer `setuptools` versions (e.g., setuptools 74) and `CMake 4`. The `dry-run` option was also removed due to setuptools changes. Older versions of setuptools may no longer be compatible.","severity":"breaking","affected_versions":"0.19.0+"},{"fix":"For new projects, evaluate `scikit-build-core`. If sticking with `scikit-build`, be aware of its tighter coupling with `setuptools`.","message":"Scikit-build is the 'classic' setuptools-based integration. For new projects, consider `scikit-build-core`, which is a ground-up rewrite that acts as a standalone build backend without direct `setuptools` dependency and offers improved features and stability.","severity":"gotcha","affected_versions":"All"},{"fix":"Avoid editable installs, or be prepared for potential issues. `scikit-build-core` aims to address this with experimental editable mode support.","message":"Editable installs using `scikit-build` (classic) often do not work correctly with recent versions of `setuptools`.","severity":"gotcha","affected_versions":"All"},{"fix":"Manually delete the `_skbuild` directory if facing build problems or switching environments.","message":"The `_skbuild` cache directory may need to be manually deleted between builds, especially if changing the Python interpreter or encountering unexpected build issues.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure CMake version is 3.18 or higher (as recommended in examples for 0.19.0) and ideally 3.24+ to avoid potential issues with library specification.","message":"Minimum required CMake version is 3.5 since scikit-build 0.18.0. Additionally, older CMake versions (<3.24) may break when a library is specified, as fixed in 0.17.1.","severity":"breaking","affected_versions":"0.18.0+"},{"fix":"Focus on using `scikit-build` for generating distributable packages (wheels/sdists) rather than direct `build_ext --inplace` invocations. Use PEP 517/518 compliant build processes (e.g., `pip install .` or `python -m build`).","message":"The behavior of directly driving the CMake build of a module via `setup.py` (`python setup.py build_ext --inplace`) is considered legacy and is no longer the recommended approach. Scikit-build's primary utility is driving the generation of Python distributables for PyPI.","severity":"deprecated","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}