File tree Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ scikit\_build\_core.errors module
4141 :show-inheritance:
4242 :undoc-members:
4343
44+ scikit\_ build\_ core.format module
45+ ---------------------------------
46+
47+ .. automodule :: scikit_build_core.format
48+ :members:
49+ :show-inheritance:
50+ :undoc-members:
51+
4452scikit\_ build\_ core.program\_ search module
4553------------------------------------------
4654
Original file line number Diff line number Diff line change @@ -290,9 +290,6 @@ known-local-folder = ["pathutils"]
290290"typing.Self".msg = " Use scikit_build_core._compat.typing.Self instead."
291291"typing_extensions.Self".msg = " Use scikit_build_core._compat.typing.Self instead."
292292"typing.Final".msg = " Add scikit_build_core._compat.typing.Final instead."
293- "typing.NotRequired".msg = " Add scikit_build_core._compat.typing.NotRequired instead."
294- "typing.OrderedDict".msg = " Add scikit_build_core._compat.typing.OrderedDict instead."
295- "typing.TypedDict".msg = " Add scikit_build_core._compat.typing.TypedDict instead."
296293"typing.assert_never".msg = " Add scikit_build_core._compat.typing.assert_never instead."
297294"tomli".msg = " Use scikit_build_core._compat.tomllib instead."
298295"tomllib".msg = " Use scikit_build_core._compat.tomllib instead."
Original file line number Diff line number Diff line change 1+ """Format variables available in the ``pyproject.toml`` evaluation"""
2+
3+ from __future__ import annotations
4+
5+ from typing import TYPE_CHECKING , TypedDict
6+
7+ if TYPE_CHECKING :
8+ from scikit_build_core .settings .skbuild_model import ScikitBuildSettings
9+
10+ __all__ = [
11+ "pyproject_format" ,
12+ ]
13+
14+
15+ def __dir__ () -> list [str ]:
16+ return __all__
17+
18+
19+ class PyprojectFormatter (TypedDict , total = False ):
20+ """Format helper for pyproject.toml.
21+
22+ Stores all known variables that can be used for evaluating a formatted string
23+ in the pyproject.toml config file.
24+ """
25+
26+
27+ def pyproject_format (
28+ * ,
29+ settings : ScikitBuildSettings | None = None , # noqa: ARG001
30+ dummy : bool = False ,
31+ ) -> PyprojectFormatter | dict [str , str ]:
32+ if dummy :
33+ # Return a dict with all the known keys but with values replaced with dummy values
34+ return {key : "*" for key in PyprojectFormatter .__annotations__ }
35+ return PyprojectFormatter ()
You can’t perform that action at this time.
0 commit comments