Skip to main content

PEP 517 builder for Scikit-Build

Project description

scikit-build-core

Actions Status Documentation Status Code style: black codecov

WARNING: Experimental. All configuration subject to change. Only scikit_build_core.build should be used (setuptools backend is experimental and likely to move to a separate package).

The following limitations are present compared to classic scikit-build:

  • The minimum supported CMake is 3.15
  • The minimum supported Python is 3.7
  • Only the Ninja generator is supported on UNIX
  • Only the MSVC generator (currently not tied to the current Python) is supported on Windows

Some of these limitations might be adjusted over time, based on user requirements & effort / maintainability.

This is very much a WIP, some missing features:

  • The extensionlib integration is missing
  • No hatchling plugin yet
  • The docs are not written
  • The logging system isn't ideal yet
  • Dedicated entrypoints still need to be designed
  • No support for other targets besides install
  • C++17 is required for the test suite because it's more fun than C++11/14
  • No support for caching between builds
  • No editable mode support
  • No extra wheel directories (like headers) supported yet
  • Windows ARM support missing
  • No Limited API / Stable ABI support yet, or pythonless tags

Features over classic Scikit-build:

  • Better warnings and errors
  • No warning about unused variables
  • Automatically adds Ninja and/or CMake only as required
  • Closer to vanilla setuptools in setuptools mode, doesn't interfere with config
  • Powerful config system
  • Automatic inclusion of site-packages in CMAKE_PREFIX_PATH
  • FindPython is backported if running on CMake < 3.24 (included via hatchling in a submodule)

Currently, the recommended interface is the PEP 517 interface. There is also a setuptools-based interface that is being developed to provide a transition path for classic scikit-build.

Example

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...3.24)

project(${SKBUILD_PROJECT_NAME} LANGUAGES C VERSION ${SKBUILD_PROJECT_VERSION})

find_package(Python COMPONENTS Interpreter Development.Module)

Python_add_library(_module MODULE src/module.c WITH_SOABI)

install(TARGETS _module DESTINATION ${SKBUILD_PROJECT_NAME})
install(FILES src/simplest/__init__.py
        DESTINATION ${SKBUILD_PROJECT_NAME})

Scikit-build-core will backport FindPython from CMake 3.24 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-modules (so you will usually prefix everything by the package name).

Warning: FindPython does not report the correct SOABI for PyPy due to the SOABI being reported incorrectly. This will be fixed in the next release of PyPy. And PyPy doesn't support skipping the SOABI to avoid clashes with CPython. Pybind11's pybind11_add_module handles this correctly for you.

More examples are in the tests/packages.

Acknowledgements

Support for this work was provided by NSF cooperative agreement 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_core-0.1.0a0.tar.gz (81.2 kB view details)

Uploaded Source

Built Distribution

scikit_build_core-0.1.0a0-py3-none-any.whl (80.8 kB view details)

Uploaded Python 3

File details

Details for the file scikit_build_core-0.1.0a0.tar.gz.

File metadata

  • Download URL: scikit_build_core-0.1.0a0.tar.gz
  • Upload date:
  • Size: 81.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for scikit_build_core-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 4be16d9d00405a88ae421a4cf51e58d8dcbf2d0dbedae5951c9873b4d845e321
MD5 ca8c9dbbb3dadc116e26aed608d07354
BLAKE2b-256 5db77f1b17cd290fd700b54a06549135dda21ed3b5efadec6e2c8693ab81aadc

See more details on using hashes here.

File details

Details for the file scikit_build_core-0.1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for scikit_build_core-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad5e4eb78bf034db2a61d46de7b40dd144fdb344f24ecacbda7e98ca25504c1
MD5 3400d4a70bfd30aad2bb1a264456a0d5
BLAKE2b-256 20f2ce98ebce47b0128a20c36004c4e750cffd33236e97f908d56bd410839952

See more details on using hashes here.

Supported by

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