File tree Expand file tree Collapse file tree 3 files changed +45
-3
lines changed Expand file tree Collapse file tree 3 files changed +45
-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+ "PyprojectFormatter" ,
12+ "pyproject_format" ,
13+ ]
14+
15+
16+ def __dir__ () -> list [str ]:
17+ return __all__
18+
19+
20+ class PyprojectFormatter (TypedDict , total = False ):
21+ """Format helper for pyproject.toml.
22+
23+ Stores all known variables that can be used for evaluating a formatted string
24+ in the pyproject.toml config file.
25+ """
26+
27+
28+ def pyproject_format (
29+ * ,
30+ settings : ScikitBuildSettings | None = None , # noqa: ARG001
31+ dummy : bool = False ,
32+ ) -> PyprojectFormatter | dict [str , str ]:
33+ """Generate :py:class:`PyprojectFormatter` dictionary to use in f-string format."""
34+ if dummy :
35+ # Return a dict with all the known keys but with values replaced with dummy values
36+ return {key : "*" for key in PyprojectFormatter .__annotations__ }
37+ return PyprojectFormatter ()
You can’t perform that action at this time.
0 commit comments