Skip to main content

Improved build system generator for Python C/C++/Fortran/Cython extensions

Project description

scikit-build is a Python build system for CPython C/C++/Fortran/Cython extensions using CMake.

The scikit-build package is fundamentally just glue between the setuptools Python module and CMake.

The next generation of scikit-build, scikit-build-core, provides a simple, reliable build backend for CMake that does not use setuptools and provides a lot of new features. Since scikit-build 1.0, scikit-build (classic) is a thin wrapper around scikit-build-core's setuptools plugin. If you do not require setuptools, you should consider using scikit-build-core directly instead. This package only adds the legacy CMake helper modules (which have modern equivalents) and the compatibility setup() wrapper.

To get started, see this example. For more examples, see scikit-build-sample-projects.

Quick upgrade instructions for 1.0

Code should build (using standards-based tools, like pip/uv/build/cibuildwheel) as long as you are not using our internals. setup.py commands may not work (a few do, like setup.py build_ext --inplace, which works better than before). You can now use tool.scikit-build, as described by scikit-build-core.

If you keep from skbuild import setup in setup.py, require scikit-build and use scikit-build-core's setuptools backend for auto-cmake/ninja and config-settings support:

[build-system]
requires = ["scikit-build>=1"]
build-backend = "scikit_build_core.setuptools.build_meta"

If you want to use scikit-build-core directly but keep setuptools:

[build-system]
requires = ["scikit-build-core[setuptools]>=1"]
build-backend = "scikit_build_core.setuptools.build_meta"

And either use setup with at least a cmake_source_dir argument:

from setuptools import setup

setup(cmake_source_dir=".")

or the following in your pyproject.toml:

[tool.scikit-build]
cmake.source-dir = "."

Either one of those will cause scikit-build-core's setuptools plugin to activate. The defaults for the native plugin are different from the skbuild.setup() wrapper (scikit_build_core.setuptools.wrapper.setup()); for example SKBUILD_CONFIGURE_OPTIONS/SKBUILD_BUILD_OPTIONS are not adapted without the wrapper.

And if you want to use the native, non-setuptools backend:

[build-system]
requires = ["scikit-build-core>=1"]
build-backend = "scikit_build_core.build"

You'll need to use a project table and tool.scikit-build; setup.py, MANIFEST.in, and setup.cfg have no effect without setuptools. The native backend is recommended unless you specifically need a setuptools or hatchling plugin, e.g. to combine with other plugins.

Scikit-build 1.0.0

The classic scikit-build backend has been replaced by scikit-build-core's setuptools plugin. skbuild.setup() is now a thin wrapper around scikit_build_core.setuptools.wrapper.setup(), and scikit-build depends on scikit-build-core[setuptools]. Most packages — those that only use from skbuild import setup with the documented cmake_* keyword arguments — will continue to build unchanged. New projects are still encouraged to use scikit-build-core directly.

What still works:

  • from skbuild import setup with cmake_args, cmake_source_dir, cmake_install_dir, cmake_install_target, and cmake_process_manifest_hook.
  • The shipped CMake modules (find_package(PythonExtensions), Cython, F2PY, NumPy, ...), now provided via scikit-build-core's cmake.module entry point.
  • The SKBUILD CMake variable is still set (now "2" instead of TRUE; both are truthy).
  • setup.py build_ext --inplace builds into the source tree without extra configuration.

Breaking changes:

  • The scikit-build specific command line options were removed: --build-type, -G/--generator, -j, --cmake-executable, --skip-generator-test, --hide-listing, --force-cmake, --skip-cmake, --install-target, and the setup.py <args> -- <cmake args> -- <build tool args> syntax. Use the CMAKE_ARGS/CMAKE_GENERATOR environment variables, the cmake_args keyword, or [tool.scikit-build] settings / SKBUILD_* environment variables instead.
  • cmake_with_sdist=True now raises an error; cmake_languages and cmake_minimum_required_version are ignored with a warning (set cmake.version in [tool.scikit-build] instead).
  • The internal modules skbuild.command, skbuild.platform_specifics, skbuild.utils, and skbuild.setuptools_wrap were removed. skbuild.constants and skbuild.cmaker are now deprecation shims keeping only the helpers downstream setup.py files use: skbuild_plat_name(), CMAKE_INSTALL_DIR(), and get_cmake_version(). skbuild.exceptions.SKBuildError is now an alias of setuptools' SetupError, so it is no longer a RuntimeError; its SKBuildInvalidFileInstallationError and SKBuildGeneratorNotFoundError subclasses were removed.
  • The _skbuild build directory is gone; the standard setuptools build/ directories are used (CMake builds in an _skbuild directory under build/temp.*).
  • sdists no longer auto-generate their manifest from git; provide a MANIFEST.in (or use setuptools-scm) like any setuptools project.
  • Editable installs (pip install -e .) require editable.mode = "inplace" in the [tool.scikit-build] table of pyproject.toml.
  • CMake generator probing (including Visual Studio discovery) was removed; CMake's own default generator selection applies, and CMAKE_GENERATOR overrides it.
  • Dependencies changed to scikit-build-core[setuptools]; distro, wheel, and tomli were dropped.
  • Python 3.8 and 3.9 support was dropped; Python 3.10+ is required.

Features

  • Use scikit-build-core's setuptools plugin as the backend in #1185
  • Drop Python 3.8 support in #1207
  • Drop Python 3.9 support in #1210

Bug fixes

  • Repair add_f2py_target argument handling and the F2PY version regex in #1216
  • Fix the python_modules_header include-dir output variable and drop a debug print in #1217

Documentation

  • Review and update for the scikit-build-core backend in #1212
  • Recommend the scikit-build-core setuptools backend in #1213
  • Switch to furo, matching scikit-build-core, in #1208
  • Convert changelog and README to Markdown with MyST in #1198

Testing

  • Trim the suite now that the backend lives in scikit-build-core in #1211
  • Tolerate CMake 4 install path normalization in #1205
  • Split the test matrix per Python version in #1209
  • Test on Python 3.15 in #1215

Miscellaneous

  • Mark as Production/Stable and prepare the release in #1222
  • Remove dead code and fix docs in the CMake modules in #1218
  • Pin GitHub Actions to commit SHAs and harden workflows in #1219 and #1221
  • Drop ref-names from .git_archival.txt in #1220
  • Packit maintenance in #1201
  • Bump the actions group in #1200 and #1204
  • Pre-commit autoupdate in #1199, #1203, and #1206

Scikit-build 0.19.1

This is a patch release to add support for Visual Studio 2026.

Features

  • Support Visual Studio 18 2026 in #1186

Bug fixes

  • Correctness bugs found in code review in #1191
  • Resolve Visual Studio generator environments lazily in #1193

Testing

  • Add windows-latest job for Visual Studio 2026 in #1194
  • Convert decorator into fixture in #1175
  • Remove usage of py.path in #1173
  • Make symlink auto-generated in #1172

Miscellaneous

  • Trivial cleanups found in code review in #1192
  • Update ruff-check and a bit more in #1174
  • Add agent files in #1184
  • Bump setup-uv to maintained tag scheme in #1179
  • Bump the actions group in #1180 and #1183
  • Bump actions/checkout from 6 to 7 in #1190
  • Pre-commit autoupdate in #1176, #1182, and #1187

Scikit-build 0.19.0

This release updates for changes in setuptools and CMake 4, and drops Python 3.7.

Features

  • Drop Python 3.7 in #1134

Bug fixes

  • Update for newer setuptools in #1120
  • setuptools_wrap.py: parse CMAKE_ARGS with shlex.split like elsewhere by @haampie in #1126
  • Drop dry-run (removed in setuptools) in #1166
  • Ensure generic f2py executable is looked up first by @smiet in #1111

Testing

  • Support Python 3.14 in CI in #1167
  • pytest log_level is better than log_cli_level in #1164

Miscellaneous

  • Bot suffix now required for changelog filtering in #1168

Scikit-build 0.18.1

This release fixes issues with setuptools 74, and avoids a warning from recent versions of wheel. Android and iOS are now included in known platforms.

Bug fixes

Testing

Scikit-build 0.18.0

This release bumps the minimum required CMake to 3.5 and supports CPython 3.13.

Bug fixes

  • Support MSVC 17.10 in #1081
  • CMake 3.5+ requirement in #1095
  • Support CPython 3.13 with windows lib finding fix in #1094
  • Don't die on PermissionError during chmod by @mweinelt in #1073
  • Remove usage of deprecated distutils in cmake files by @hmaarrfk in #1032
  • Use first available option for vswhere output by @ZzEeKkAa in #1030

Testing

Fedora CI

Miscellaneous

  • Clean up pylint in #1017
  • Fix mypy type ignores for new setuptools types in #1082
  • Move to Ruff-format in #1035
  • Remove pkg_resources and test command in #1014
  • Ruff moved to astral-sh in #1007
  • Target-version no longer needed by Black or Ruff in #1008
  • Update ruff and fix warnings in #1060
  • Use 2x faster black mirror in #1021
  • Group dependabot updates in #1054
  • macos-latest is changing to macos-14 ARM runners in #1083
  • Skip win PyPy PEP 518 in #1091

Scikit-build 0.17.6

A small fix release with some new platforms and better testing, including CPython 3.12.0b1.

Bug fixes

Testing

  • Tests now pass on CPython 3.12.0b1 in #879.
  • Tests no longer use pytest-virtualenv in #879.
  • isolated marker now includes test_distribution tests in #879.
  • Tests avoid incorrect get_map match by @keszybz in #990.
  • Fedora testing fix by @LecrisUT in #986 and #938.

Miscellaneous

  • Docs improvements in #979.

Scikit-build 0.17.5

A small fix release fixing the passing on of generator specific arguments. This fixes some cases where the Ninja generator was found but then was unable to build. NetBSD was reported to work, so was added to the BSD's supported.

Bug fixes

  • Generator args were missing for actual compile in #975.
  • Add support for netbsd & pyodide (future) in #977.

Scikit-build 0.17.4

A followup fix to the issue 0.17.3 tried to fix. We now have a method to manually test downstream packages, too.

Bug fixes

  • Make sure include dir is found even if the lib is not present in #974.

Scikit-build 0.17.3

A small release related to PYTHON_LIBRARY handling changes in 0.17.2; scikit-build 0.17.3 returns an empty string from get_python_library if no Python library is present (like on manylinux), where 0.17.2 returned None, and previous versions returned a non-existent path. Note that adding REQUIRED to find_package(PythonLibs will fail, but it is incorrect (you must not link to libPython.so) and was really just injecting a non-existent path before.

Bug fixes

  • Keep get_python_library return type string if python lib non-existing for now in #959.
  • Avoid 'not found' warning if libs are not found by FindPythonExtensions in #960.
  • FindNumPy should not call FindPythonLibs in #958.

Scikit-build 0.17.2

Another small release with fixes for non-MSVC Windows platforms.

Bug fixes

  • RPM spec fix by @LecrisUT in #937.
  • Validate value before returning library path by @dlech in #942.
  • Only add Python_LIBRARY on Windows MSVC in #943 and #944.
  • Slightly nicer traceback for failed compiler in #947.

Testing

  • Hide a few warnings that are expected in #948.

Scikit-build 0.17.1

This is a small release fixing a few bugs; the primary one being a change that was triggering a bug in older FindPython. The unused variable messages have been deactivated to simplify output, as well.

Bug fixes

  • Older (<3.24) CMake breaks when lib specified in #932.
  • An error output was missing formatting in #931.
  • Make empty CMAKE_OSX_DEPLOYMENT_TARGET a warning (bug in conda-forge's clang activation fixed upstream) in #934.
  • Remove unused variable warnings by in #930.

Testing

Scikit-build 0.17.0

A lot of bug fixes are present in this release, focusing on Windows, PyPy, and cross compiling. We've also improved the compatibility with default setuptools behaviors a little, and enabled some things that were previously unavailable, like overriding the build type via the cmake argument environment variables. We've expanded our CI matrix to include Windows and macOS PyPy and some Fortran tests on Linux. This release requires Python 3.7+.

Bug fixes

  • Match setuptools behavior for include_package_data default. by @vyasr in #873.
  • Misc. fixes for F2PY and PythonExtensions modules by @benbovy in #495.
  • Provide more useful error if user provides CMAKE_INSTALL_PREFIX by @vyasr in #872.
  • Stop assuming that .pyx files are in the same directory as CMakeLists.txt by @vyasr in #871.
  • Allow build type overriding in #902.
  • Detect PyPy library correctly on Windows by user:`gershnik` in #904.
  • Include library for FindPython for better Windows cross-compiles in #913. Thanks to user:`maxbachmann` for testing.
  • Fix logic for default generator when cross-compiling for ARM on Windows in #917 by @dlech.
  • Use f2py's get_include if present in #877.
  • Fix support for cross-compilation exception using targetLinkLibrariesWithDynamicLookup by @erykoff in #901.
  • Treat empty MACOSX_DEPLOYMENT_TARGET as if it was unset in #918.

Testing

  • Add hello fortran sample package + tests by @benbovy in #493.
  • Add sdist check & fix in #906.
  • Fix some setuptools types in #888.
  • Add PyPy Win & macOS to the CI in #907.
  • Add tests for Python 3.12 Linux alphas in #922.

Miscellaneous

  • Drop Python 3.6 in #862.
  • Move building backend to hatchling in #870.
  • Avoid mutating function input parameters in #899.
  • Use _compat/typing name in #869.

Publications

Please use the first citation when referencing scikit-build in scientific publications.

  • Jean-Christophe Fillion-Robin, Matt McCormick, Omar Padron, Max Smolens, Michael Grauer, & Michael Sarahan. (2018, July 13). jcfr/scipy_2018_scikit-build_talk: SciPy 2018 Talk | scikit-build: A Build System Generator for CPython C/C++/Fortran/Cython Extensions. Zenodo. https://doi.org/10.5281/zenodo.2565368
  • Schreiner, Henry, Rickerby, Joe, Grosse-Kunstleve, Ralf, Jakob, Wenzel, Darbois, Matthieu, Gokaslan, Aaron, Fillion-Robin, Jean-Christophe, & McCormick, Matt. (2022, August 1). Building Binary Extensions with pybind11, scikit-build, and cibuildwheel. https://doi.org/10.25080/majora-212e5952-033

History

PyCMake was created at SciPy 2014 in response to general difficulties building C++ and Fortran based Python extensions across platforms. It was renamed to "scikit-build" in 2016. Scikit-build-core was started in 2022, and became the backend for this package in 2026.

New backend

  • All deprecated setuptools/distutils features are removed in scikit-build 1.0, like the test command, easy_install, etc. Use standards-based development instead, like uv, pip, build, etc.
  • Older versions of CMake (<3.15) are no longer supported.

Miscellaneous

Support for this work was provided by NSF grant OAC-2209877.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit_build-1.0.0rc1.tar.gz (226.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scikit_build-1.0.0rc1-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file scikit_build-1.0.0rc1.tar.gz.

File metadata

  • Download URL: scikit_build-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 226.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for scikit_build-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 f8f26f3d362c57dae8cacc1322d79d790e1a9be89a9ded0211fdd2757fdc177c
MD5 4d8fa220c2378cd03af620f48244c56f
BLAKE2b-256 7ec7e2b791d8df120f69086e72bb3a3cfa338e1e3332f903c1445943bc79c5b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for scikit_build-1.0.0rc1.tar.gz:

Publisher: cd.yml on scikit-build/scikit-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scikit_build-1.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: scikit_build-1.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for scikit_build-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 418b0810add66c9699bdf3e81184ea453afc9e10e620448a34baaee8dfd5b895
MD5 c105f491f60ffe375ab370bff0a71c24
BLAKE2b-256 47c849d87aad3df15086ab3182c3c1ac5202abed6eafe9296b136c0ccddcbdd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for scikit_build-1.0.0rc1-py3-none-any.whl:

Publisher: cd.yml on scikit-build/scikit-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page