Formattable fieldsΒΆ

The following configure keys are formatted as Python str.format templates:

  • build-dir

  • build.requires

  • editable.rebuild-dir

Added in version 1.0: editable.rebuild-dir is formattable.

Added in version 1.1.2: {build_dir} in editable.rebuild-dir.

For example, to get a persistent build directory per wheel tag:

[tool.scikit-build]
build-dir = "build/{wheel_tag}"

The available variables are the members of scikit_build_core.format.PyprojectFormatter:

PyprojectFormatter.build_dir: NotRequired[str]

The resolved build-dir. Only available in editable.rebuild-dir, e.g. rebuild-dir = "{build_dir}/install/{wheel_tag}" keeps the install tree next to the build tree when SKBUILD_BUILD_DIR moves it.

PyprojectFormatter.build_type: NotRequired[str]

Build type passed as cmake.build_type.

PyprojectFormatter.cache_tag: NotRequired[str]

Tag used by the import machinery in the filenames of cached modules, i.e. sys.implementation.cache_tag.

PyprojectFormatter.name: NotRequired[str]

The normalized project name (canonicalized per PEP 503, then - replaced by _), matching the wheel/sdist filename. Handy to disambiguate a shared build-dir across a workspace, e.g. build-dir = "build/{name}/{wheel_tag}". Not available while resolving build.requires, since metadata is not read yet at that point.

PyprojectFormatter.root: NotRequired[RootPathResolver]

Root path of the current project.

PyprojectFormatter.state: NotRequired[Literal['sdist', 'wheel', 'editable', 'metadata_wheel', 'metadata_editable']]

The state of the build.

PyprojectFormatter.wheel_tag: NotRequired[str]

The tags as computed for the wheel.