scikit_build_core.build package

This is the entry point for the build backend. Items in this module are designed for the build backend API.

scikit_build_core.build.build_editable(wheel_directory, config_settings=None, metadata_directory=None)[source]
Return type:

str

scikit_build_core.build.build_sdist(sdist_directory, config_settings=None)[source]
Return type:

str

scikit_build_core.build.build_wheel(wheel_directory, config_settings=None, metadata_directory=None)[source]
Return type:

str

scikit_build_core.build.get_requires_for_build_editable(config_settings=None)[source]
Return type:

list[str]

scikit_build_core.build.get_requires_for_build_sdist(config_settings=None)[source]
Return type:

list[str]

scikit_build_core.build.get_requires_for_build_wheel(config_settings=None)[source]
Return type:

list[str]

scikit_build_core.build.prepare_metadata_for_build_editable(metadata_directory, config_settings=None)[source]

Prepare metadata for building a wheel. Does not build the wheel. Returns the dist-info directory.

Return type:

str

scikit_build_core.build.prepare_metadata_for_build_wheel(metadata_directory, config_settings=None)[source]

Prepare metadata for building a wheel. Does not build the wheel. Returns the dist-info directory.

Return type:

str

Submodules

scikit_build_core.build.common_wheel_helpers module

Shared CMake-build orchestration for the wheel backend (build/wheel.py) and the hatchling plugin (hatch/plugin.py).

These helpers cover the band that is identical between the two callers: tag computation, build/wheel/install directory layout, and running configure/build/install. The wheel-assembly side (WheelWriter vs hatchling build_data delegation) deliberately stays in each caller.

scikit_build_core.build.common_wheel_helpers.build_install_extra_build_types(builder, *, settings, wheel_dirs, install_dir, state, name, version, editable, extra_cache_entries=None)[source]

Build and install build types beyond the primary into the same wheel.

Single-config generators (Ninja, Makefiles) are reconfigured into a fresh builder for each extra build type; multi-config generators just build the extra --config with the original builder. Everything installs to the same prefix. Call this after the primary build and install.

Return type:

None

scikit_build_core.build.common_wheel_helpers.build_wheel(builder)[source]

Build the configured CMake project.

Return type:

None

scikit_build_core.build.common_wheel_helpers.configure_wheel(*, cmake, settings, wheel_dirs, install_dir, build_dir, state, name, version, extra_cache_entries=None, build_type=None)[source]

Configure the CMake project, returning the Builder to build with.

Defaults to the primary (first) build type. It is rerunnable: pass an extra build_type to reconfigure a single-config generator into a fresh builder for that build type (see build_install_extra_build_types()).

Return type:

Builder

scikit_build_core.build.common_wheel_helpers.editable_rebuild_options(builder)[source]

Flags so an editable rebuild reproduces this build’s config selection.

Returns (build_options, install_options) for the redirect shim’s runtime cmake --build / cmake --install. Deliberately a subset: it excludes --prefix (the shim supplies its own), --strip, and components.

Return type:

tuple[list[str], list[str]]

scikit_build_core.build.common_wheel_helpers.get_build_dir(settings, *, tags, state, editable, has_cmake, fallback, name)[source]

Where CMake configures and builds: the source dir for inplace editable builds, the (formatted) configured build-dir, or fallback otherwise.

name is the normalized project name, used to fill a {name} placeholder in build-dir.

Return type:

Path

scikit_build_core.build.common_wheel_helpers.get_editable_rebuild_dir(settings, *, build_dir, targetlib, tags, state, name)[source]

Persistent install tree for a rebuildable redirect editable.

editable.rebuild-dir (formatted like build-dir) overrides the default install/<targetlib> tree inside build-dir. The redirect references the compiled artifacts here by absolute path, so it must be stable between build and run time (#1135).

Return type:

Path

scikit_build_core.build.common_wheel_helpers.get_install_dir(settings, *, wheel_dirs, targetlib)[source]

Resolve wheel.install-dir to an absolute path inside the wheel tree.

Return type:

Path

scikit_build_core.build.common_wheel_helpers.get_targetlib(settings)[source]

The wheel lib directory the build targets. wheel.platlib forces the choice; otherwise a CMake build is platlib and a Python-only build purelib.

Return type:

Literal['platlib', 'purelib']

scikit_build_core.build.common_wheel_helpers.get_wheel_tag(settings, *, targetlib)[source]

Compute the best wheel tag for the current environment.

Return type:

WheelTag

scikit_build_core.build.common_wheel_helpers.install_wheel(builder, *, install_dir, editable)[source]

Install the built project into the wheel tree.

Skipped for editable inplace builds, which load from the build tree directly.

Return type:

None

scikit_build_core.build.common_wheel_helpers.prepare_editable_rebuild_dir(targetlib_dir, *, guard)[source]

Clean and (re)create the persistent install tree for a rebuildable editable.

The tree is wiped so stale artifacts from a previous build don’t linger (a cmake --install only ever adds files). The default tree lives inside build-dir and is fully owned by scikit-build-core, so wiping is always safe (guard=False).

A user-chosen editable.rebuild-dir (guard=True) may accidentally point at a populated directory – e.g. the package’s own source tree. Wiping that would delete the user’s source (#1135), so refuse unless the directory is empty or carries the cache-tag we drop on a tree we created ourselves. A guarded tree also gets a .gitignore so its compiled artifacts stay out of version control.

Return type:

None

scikit_build_core.build.common_wheel_helpers.prepare_wheel_dirs(wheel_root, *, targetlib)[source]

Create the staging wheel tree under wheel_root and return its dirs.

Return type:

dict[str, Path]

scikit_build_core.build.generate module

scikit_build_core.build.generate.generate_file_contents(gen, metadata)[source]

Generate a file contents from a template. Input GeneratorSettings and metadata. Metadata is available inside the template.

Return type:

str

scikit_build_core.build.metadata module

scikit_build_core.build.metadata.get_standard_metadata(pyproject_dict, settings, build_state='metadata_wheel')[source]
Return type:

StandardMetadata

scikit_build_core.build.sdist module

scikit_build_core.build.sdist.build_sdist(sdist_directory, config_settings=None)[source]
Return type:

str

scikit_build_core.build.wheel module