Skip to content

Commit 0bf15ab

Browse files
committed
Document build.requires feature
Signed-off-by: Cristian Le <[email protected]>
1 parent 07d5cf3 commit 0bf15ab

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/configuration/dynamic.md

+39
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,45 @@ metadata.readme.provider = "scikit_build_core.metadata.fancy_pypi_readme"
112112
# tool.hatch.metadata.hooks.fancy-pypi-readme options here
113113
```
114114

115+
## `build-system.requires`: Scikit-build-core's `build.requires`
116+
117+
```{versionadded} 0.11
118+
119+
```
120+
121+
If you need to inject and manipulate additional `build-system.requires`, you can
122+
use the `build.requires`. This is intended to be used in combination with
123+
[](./overrides.md).
124+
125+
This is not technically a dynamic metadata and thus does not have to have the
126+
`dynamic` field defined, and it is not defined under the `metadata` table, but
127+
similar to the other dynamic metadata it injects the additional
128+
`build-system.requires`.
129+
130+
```toml
131+
[package]
132+
name = "mypackage"
133+
134+
[tool.scikit-build]
135+
build.requires = ["foo"]
136+
137+
[[tool.scikit-build.overrides]]
138+
if.from-sdist = false
139+
build.requires = ["foo @ {root:uri}/foo"]
140+
```
141+
142+
This example shows a common use-case where the package has a default
143+
`build-system.requires` pointing to the package `foo` in the PyPI index, but
144+
when built from the original git checkout or equivalent, the local folder is
145+
used as dependency instead by resolving the `{root:uri}` to a file uri pointing
146+
to the folder where the `pyproject.toml` is located.
147+
148+
```{note}
149+
In order to be compliant with the package index, when building from `sdist`, the
150+
`build.requires` **MUST NOT** have any `@` redirects. This rule may be later
151+
enforced explicitly.
152+
```
153+
115154
## Generate files with dynamic metadata
116155

117156
You can write out metadata to file(s) as well. Other info might become available

0 commit comments

Comments
 (0)