Skip to content

Commit 24ad234

Browse files
committed
Document build.build-requires feature
Signed-off-by: Cristian Le <[email protected]>
1 parent 96e089d commit 24ad234

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Diff for: docs/configuration.md

+41
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,47 @@ Support for `result` and `remove` added.
649649

650650
:::
651651

652+
:::{tab} build-requires
653+
654+
```{versionadded} 0.11
655+
656+
```
657+
658+
If you need to inject and manipulate additional `build-system.requires`, you can
659+
use the `build.build-requires`. This is intended to be used in combination with
660+
[](./overrides.md).
661+
662+
This is not technically a dynamic metadata and thus does not have to have the
663+
`dynamic` field defined, and it is not defined under the `metadata` table, but
664+
similar to the other dynamic metadata it injects the additional
665+
`build-system.requires`.
666+
667+
```toml
668+
[package]
669+
name = "mypackage"
670+
671+
[tool.scikit-build.build]
672+
build-requires = ["foo"]
673+
674+
[[tool.scikit-build.overrides]]
675+
if.from-sdist = false
676+
build.build-requires = ["foo @ {root:uri}/foo"]
677+
```
678+
679+
This example shows a common use-case where the package has a default
680+
`build-system.requires` pointing to the package `foo` in the PyPI index, but
681+
when built from the original git checkout or equivalent, the local folder is
682+
used as dependency instead by resolving the `{root:uri}` to a file uri pointing
683+
to the folder where the `pyproject.toml` is located.
684+
685+
```{note}
686+
In order to be compliant with the package index, when building from `sdist`, the
687+
`build.build-requires` **MUST NOT** have any `@` redirects. This rule may be later
688+
enforced explicitly.
689+
```
690+
691+
:::
692+
652693
:::{warning}
653694

654695
Your package and third-party packages can also extend these with new plugins,

0 commit comments

Comments
 (0)