Skip to content

Commit ad5278e

Browse files
committed
Document formattable fields
Signed-off-by: Cristian Le <[email protected]>
1 parent b978f69 commit ad5278e

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

docs/configuration/formatted.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Formattable fields
2+
3+
The following configure keys are formatted as Python f-strings:
4+
5+
- `build-dir`
6+
- `build.requires`
7+
8+
The available variables are documented in the members of
9+
{py:class}`scikit_build_core.format.PyprojectFormatter` copied here for
10+
visibility
11+
12+
```{eval-rst}
13+
.. autoattribute:: scikit_build_core.format.PyprojectFormatter.build_type
14+
:no-index:
15+
16+
.. autoattribute:: scikit_build_core.format.PyprojectFormatter.cache_tag
17+
:no-index:
18+
19+
.. autoattribute:: scikit_build_core.format.PyprojectFormatter.root
20+
:no-index:
21+
22+
.. autoattribute:: scikit_build_core.format.PyprojectFormatter.state
23+
:no-index:
24+
25+
.. autoattribute:: scikit_build_core.format.PyprojectFormatter.wheel_tag
26+
:no-index:
27+
```

docs/configuration/index.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,8 @@ speedups.
643643
644644
```
645645

646-
There are several values you can access through Python's formatting syntax:
647-
648-
- `cache_tag`: `sys.implementation.cache_tag`
649-
- `wheel_tag`: The tags as computed for the wheel
650-
- `build_type`: The current build type (`Release` by default)
651-
- `state`: The current run state, `sdist`, `wheel`, `editable`,
652-
`metadata_wheel`, and `metadata_editable`
646+
There are several values you can access through Python's formatting syntax. See
647+
[](./formatted.md).
653648

654649
Scikit-build-core also strictly validates configuration; if you need to disable
655650
this, you can:

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ guide/faqs
4343
configuration/index
4444
configuration/overrides
4545
configuration/dynamic
46+
configuration/formatted
4647
```
4748

4849
```{toctree}

src/scikit_build_core/format.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ class PyprojectFormatter(TypedDict, total=False):
3232
"""
3333

3434
cache_tag: str
35+
"""Tag used by the import machinery in the filenames of cached modules, i.e. ``sys.implementation.cache_tag``."""
3536
wheel_tag: str
37+
"""The tags as computed for the wheel."""
3638
build_type: str
37-
state: str
39+
"""Build type passed as ``cmake.build_type``."""
40+
state: Literal["sdist", "wheel", "editable", "metadata_wheel", "metadata_editable"]
41+
"""The state of the build."""
3842
root: RootPathResolver
43+
"""Root path of the current project."""
3944

4045

4146
def pyproject_format(

0 commit comments

Comments
 (0)