setuptools-git-versioning 3.1.0__tar.gz → 3.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {setuptools_git_versioning-3.1.0/setuptools_git_versioning.egg-info → setuptools_git_versioning-3.2.0}/PKG-INFO +14 -15
  2. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/README.rst +13 -14
  3. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/pyproject.toml +13 -4
  4. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/defaults.py +1 -0
  5. setuptools_git_versioning-3.2.0/setuptools_git_versioning/dynamic_metadata.py +51 -0
  6. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/scikit_metadata.py +12 -27
  7. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/version.py +42 -23
  8. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0/setuptools_git_versioning.egg-info}/PKG-INFO +14 -15
  9. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning.egg-info/SOURCES.txt +1 -0
  10. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning.egg-info/entry_points.txt +3 -0
  11. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/LICENSE +0 -0
  12. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setup.cfg +0 -0
  13. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/__init__.py +0 -0
  14. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/__main__.py +0 -0
  15. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/archival.py +0 -0
  16. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/cli.py +0 -0
  17. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/factories.py +0 -0
  18. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/git.py +0 -0
  19. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/log.py +0 -0
  20. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/setup.py +0 -0
  21. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning/subst.py +0 -0
  22. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning.egg-info/dependency_links.txt +0 -0
  23. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning.egg-info/requires.txt +0 -0
  24. {setuptools_git_versioning-3.1.0 → setuptools_git_versioning-3.2.0}/setuptools_git_versioning.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setuptools-git-versioning
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: Use git repo data for building a version number according to PEP-440
5
5
  Author-email: dolfinus <martinov.m.s.8@gmail.com>
6
6
  License: MIT
@@ -82,8 +82,8 @@ between ``setuptools-git-versioning`` and other tools.
82
82
 
83
83
  - Only Git v2 is supported
84
84
 
85
- - Setuptools and `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backends are
86
- supported (no Poetry & others)
85
+ - Setuptools and build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_
86
+ (e.g. `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+) are supported.
87
87
 
88
88
  - Currently does not support automatic exporting of package version to a file for runtime use
89
89
  (but you can use ``setuptools-git-versioning > file`` redirect instead)
@@ -176,30 +176,29 @@ and then add new argument ``setuptools_git_versioning`` with config options:
176
176
 
177
177
  Commands are the same as above, plus ``python -m setup.py`` returns the same version.
178
178
 
179
- ``scikit-build-core``
180
- ~~~~~~~~~~~~~~~~~~~~~
179
+ ``dynamic-metadata``
180
+ ~~~~~~~~~~~~~~~~~~~~
181
181
 
182
- If your project uses the `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backend,
183
- add ``setuptools-git-versioning`` to ``build-system.requires``,
184
- mark the ``version`` field as dynamic,
185
- register the dynamic-metadata provider,
186
- and configure options under the usual ``[tool.setuptools-git-versioning]`` section:
182
+ For build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_ 0.4+,
183
+ select the registered provider in ``[[tool.dynamic-metadata]]``. For example, with
184
+ `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+:
187
185
 
188
186
  .. code:: toml
189
187
 
190
188
  [build-system]
191
- requires = [ "scikit-build-core", "setuptools-git-versioning>=3.0,<4", ]
189
+ requires = [ "scikit-build-core>=1.0", "dynamic-metadata>=0.4", "setuptools-git-versioning>=3.2,<4", ]
192
190
  build-backend = "scikit_build_core.build"
193
191
 
194
192
  [project]
195
193
  name = "mypackage"
196
194
  dynamic = ["version"]
197
195
 
198
- [tool.scikit-build.metadata.version]
199
- provider = "setuptools_git_versioning.scikit_metadata"
196
+ [[tool.dynamic-metadata]]
197
+ provider = "setuptools_git_versioning.dynamic_metadata"
200
198
 
201
199
  [tool.setuptools-git-versioning]
202
200
  enabled = true
203
201
 
204
- All options under ``[tool.setuptools-git-versioning]`` work exactly as the for ``setuptools`` backend.
205
- Inline configuration under ``[tool.scikit-build.metadata.version]`` is not supported.
202
+ The provider sets only ``version`` and reads options from ``[tool.setuptools-git-versioning]``.
203
+ Inline settings in ``[[tool.dynamic-metadata]]`` are not supported.
204
+ The provider itself has no runtime dependency on ``dynamic-metadata``.
@@ -50,8 +50,8 @@ between ``setuptools-git-versioning`` and other tools.
50
50
 
51
51
  - Only Git v2 is supported
52
52
 
53
- - Setuptools and `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backends are
54
- supported (no Poetry & others)
53
+ - Setuptools and build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_
54
+ (e.g. `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+) are supported.
55
55
 
56
56
  - Currently does not support automatic exporting of package version to a file for runtime use
57
57
  (but you can use ``setuptools-git-versioning > file`` redirect instead)
@@ -144,30 +144,29 @@ and then add new argument ``setuptools_git_versioning`` with config options:
144
144
 
145
145
  Commands are the same as above, plus ``python -m setup.py`` returns the same version.
146
146
 
147
- ``scikit-build-core``
148
- ~~~~~~~~~~~~~~~~~~~~~
147
+ ``dynamic-metadata``
148
+ ~~~~~~~~~~~~~~~~~~~~
149
149
 
150
- If your project uses the `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backend,
151
- add ``setuptools-git-versioning`` to ``build-system.requires``,
152
- mark the ``version`` field as dynamic,
153
- register the dynamic-metadata provider,
154
- and configure options under the usual ``[tool.setuptools-git-versioning]`` section:
150
+ For build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_ 0.4+,
151
+ select the registered provider in ``[[tool.dynamic-metadata]]``. For example, with
152
+ `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+:
155
153
 
156
154
  .. code:: toml
157
155
 
158
156
  [build-system]
159
- requires = [ "scikit-build-core", "setuptools-git-versioning>=3.0,<4", ]
157
+ requires = [ "scikit-build-core>=1.0", "dynamic-metadata>=0.4", "setuptools-git-versioning>=3.2,<4", ]
160
158
  build-backend = "scikit_build_core.build"
161
159
 
162
160
  [project]
163
161
  name = "mypackage"
164
162
  dynamic = ["version"]
165
163
 
166
- [tool.scikit-build.metadata.version]
167
- provider = "setuptools_git_versioning.scikit_metadata"
164
+ [[tool.dynamic-metadata]]
165
+ provider = "setuptools_git_versioning.dynamic_metadata"
168
166
 
169
167
  [tool.setuptools-git-versioning]
170
168
  enabled = true
171
169
 
172
- All options under ``[tool.setuptools-git-versioning]`` work exactly as the for ``setuptools`` backend.
173
- Inline configuration under ``[tool.scikit-build.metadata.version]`` is not supported.
170
+ The provider sets only ``version`` and reads options from ``[tool.setuptools-git-versioning]``.
171
+ Inline settings in ``[[tool.dynamic-metadata]]`` are not supported.
172
+ The provider itself has no runtime dependency on ``dynamic-metadata``.
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta:__legacy__"
9
9
 
10
10
  [project]
11
11
  name = "setuptools-git-versioning"
12
- version = "3.1.0"
12
+ version = "3.2.0"
13
13
  authors = [{name = "dolfinus", email = "martinov.m.s.8@gmail.com"}]
14
14
  license = {text = "MIT"}
15
15
  description = "Use git repo data for building a version number according to PEP-440"
@@ -55,6 +55,9 @@ setuptools_git_versioning = "setuptools_git_versioning:infer_version"
55
55
  [project.entry-points."console_scripts"]
56
56
  setuptools-git-versioning = "setuptools_git_versioning.cli:main"
57
57
 
58
+ [project.entry-points."dynamic_metadata.provider"]
59
+ "setuptools_git_versioning.dynamic_metadata" = "setuptools_git_versioning.dynamic_metadata"
60
+
58
61
  [tool.setuptools.packages.find]
59
62
  include = ["setuptools_git_versioning*"]
60
63
  exclude = ["docs*", "tests*"]
@@ -66,8 +69,8 @@ dev_template = "{tag}.post{ccount}"
66
69
 
67
70
  [dependency-groups]
68
71
  dev = [
69
- "ruff~=0.15.13",
70
- "prek~=0.4.0",
72
+ "ruff~=0.15.22",
73
+ "prek~=0.5.0",
71
74
  ]
72
75
  test = [
73
76
  "build>=1.1.1",
@@ -79,6 +82,7 @@ test = [
79
82
  "tomli-w>=1.0.0",
80
83
  "wheel>=0.42.0",
81
84
  "scikit-build-core>=0.5",
85
+ "dynamic-metadata>=0.4; python_version >= '3.8'",
82
86
  ]
83
87
  docs = [
84
88
  "furo~=2025.12.19",
@@ -110,7 +114,7 @@ line-length = 120
110
114
 
111
115
  [tool.ruff.lint]
112
116
  select = ["ALL"]
113
- ignore = ["ARG", "ANN", "A002", "COM812", "D", "TD", "FIX002", "PLC0415"]
117
+ ignore = ["ARG", "ANN", "A002", "COM812", "D", "TD", "FIX002", "PLC0415", "CPY001"]
114
118
 
115
119
  [tool.ruff.lint.per-file-ignores]
116
120
  "docs/conf.py" = ["INP001"]
@@ -176,3 +180,8 @@ showcontent = true
176
180
  directory = "misc"
177
181
  name = "Misc"
178
182
  showcontent = true
183
+
184
+ [[tool.towncrier.type]]
185
+ directory = "deprecation"
186
+ name = "Deprecation"
187
+ showcontent = true
@@ -13,6 +13,7 @@ DEFAULT_CONFIG = {
13
13
  "version_callback": None,
14
14
  "version_file": None,
15
15
  "count_commits_from_version_file": False,
16
+ "prefer_tag": False,
16
17
  "tag_formatter": None,
17
18
  "branch_formatter": None,
18
19
  "tag_filter": None,
@@ -0,0 +1,51 @@
1
+ """Version provider for the dynamic-metadata protocol."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import TYPE_CHECKING, Any
7
+
8
+ from setuptools_git_versioning.defaults import set_default_options
9
+ from setuptools_git_versioning.setup import read_toml
10
+ from setuptools_git_versioning.version import version_from_git
11
+
12
+ if TYPE_CHECKING:
13
+ from collections.abc import Mapping
14
+
15
+ __all__ = ["dynamic_metadata"]
16
+
17
+
18
+ def dynamic_metadata(
19
+ settings: Mapping[str, Any],
20
+ project: Mapping[str, Any],
21
+ ) -> dict[str, str]:
22
+ if settings:
23
+ msg = (
24
+ "Inline configuration under [[tool.dynamic-metadata]] is not supported. "
25
+ "Configure setuptools-git-versioning under [tool.setuptools-git-versioning] instead."
26
+ )
27
+ raise ValueError(msg)
28
+
29
+ root = Path.cwd()
30
+
31
+ config = read_toml(root=root)
32
+ if not config:
33
+ msg = (
34
+ "Missing [tool.setuptools-git-versioning] section in pyproject.toml. "
35
+ "Add it (with at minimum 'enabled = true') to use this provider."
36
+ )
37
+ raise ValueError(msg)
38
+
39
+ if not config.pop("enabled", True):
40
+ msg = (
41
+ "[tool.setuptools-git-versioning] has 'enabled = false' but the "
42
+ "metadata provider for setuptools-git-versioning was selected. "
43
+ "Either remove the provider or set 'enabled = true'."
44
+ )
45
+ raise ValueError(msg)
46
+
47
+ set_default_options(config)
48
+
49
+ name = project.get("name")
50
+ package_name = name if isinstance(name, str) else None
51
+ return {"version": str(version_from_git(package_name, **config, root=root))}
@@ -1,19 +1,26 @@
1
- """Dynamic metadata provider for the scikit-build-core build backend."""
1
+ """Deprecated version provider for the classic scikit-build-core protocol."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import warnings
5
6
  from pathlib import Path
6
7
  from typing import TYPE_CHECKING, Any
7
8
 
8
- from setuptools_git_versioning.defaults import set_default_options
9
- from setuptools_git_versioning.setup import read_toml
10
- from setuptools_git_versioning.version import version_from_git
9
+ from setuptools_git_versioning.dynamic_metadata import dynamic_metadata as _dynamic_metadata
11
10
 
12
11
  if TYPE_CHECKING:
13
12
  from collections.abc import Mapping
14
13
 
15
14
  __all__ = ["dynamic_metadata", "get_requires_for_dynamic_metadata"]
16
15
 
16
+ warnings.warn(
17
+ "setuptools_git_versioning.scikit_metadata is deprecated; "
18
+ "migrate to [[tool.dynamic-metadata]] with provider = 'setuptools_git_versioning.dynamic_metadata' "
19
+ "on a backend supporting dynamic-metadata such as scikit-build-core>=1.0.",
20
+ DeprecationWarning,
21
+ stacklevel=2,
22
+ )
23
+
17
24
 
18
25
  def dynamic_metadata(
19
26
  field: str,
@@ -30,29 +37,7 @@ def dynamic_metadata(
30
37
  )
31
38
  raise ValueError(msg)
32
39
 
33
- root = Path.cwd()
34
-
35
- config = read_toml(root=root)
36
- if not config:
37
- msg = (
38
- "Missing [tool.setuptools-git-versioning] section in pyproject.toml. "
39
- "Add it (with at minimum 'enabled = true') to use this provider."
40
- )
41
- raise ValueError(msg)
42
-
43
- if not config.pop("enabled", True):
44
- msg = (
45
- "[tool.setuptools-git-versioning] has 'enabled = false' but the scikit-build-core "
46
- "metadata provider for setuptools-git-versioning was selected. "
47
- "Either remove the provider or set 'enabled = true'."
48
- )
49
- raise ValueError(msg)
50
-
51
- set_default_options(config)
52
-
53
- package_name = _read_project_name(root)
54
-
55
- return str(version_from_git(package_name, **config, root=root))
40
+ return _dynamic_metadata({}, {"name": _read_project_name(Path.cwd())})["version"]
56
41
 
57
42
 
58
43
  def _read_project_name(root: Path) -> str | None:
@@ -5,7 +5,7 @@ import logging
5
5
  import os # noqa: TC003
6
6
  import re
7
7
  from pathlib import Path
8
- from typing import Callable
8
+ from typing import Callable, cast
9
9
 
10
10
  # avoid importing 'packaging' because setuptools-git-versioning can be installed using sdist
11
11
  # where 'packaging' is not installed yet
@@ -96,6 +96,7 @@ def version_from_git( # noqa: PLR0915, PLR0912, PLR0913, C901
96
96
  version_callback: str | Callable[[], str] | None = None,
97
97
  version_file: str | os.PathLike | None = None,
98
98
  count_commits_from_version_file: bool = False,
99
+ prefer_tag: bool = False,
99
100
  tag_formatter: Callable[[str], str] | str | None = None,
100
101
  branch_formatter: Callable[[str], str] | str | None = None,
101
102
  tag_filter: Callable[[str], str | None] | str | None = None,
@@ -134,6 +135,9 @@ def version_from_git( # noqa: PLR0915, PLR0912, PLR0913, C901
134
135
  raise ValueError(msg)
135
136
  return get_version_from_callback(version_callback, package_name, root=root)
136
137
 
138
+ ccount: int | None = 0
139
+ on_tag = False
140
+ tag_sha = None
137
141
  head_sha = get_sha(root=root)
138
142
  log.log(INFO, "HEAD SHA-256: %r", head_sha)
139
143
 
@@ -146,15 +150,21 @@ def version_from_git( # noqa: PLR0915, PLR0912, PLR0913, C901
146
150
  tag = get_tag(sort_by=sort_by, root=root, filter_callback=filter_callback)
147
151
  if not tag:
148
152
  log.log(INFO, "No tags found")
149
- tag_sha = None
150
- on_tag = False
151
153
  else:
152
- tag_sha = get_sha(tag, root=root)
154
+ tag_sha = cast("str", get_sha(tag, root=root))
153
155
  log.log(INFO, "Tag SHA-256: %r", tag_sha)
154
156
 
155
157
  on_tag = head_sha is not None and head_sha == tag_sha
156
158
  log.log(INFO, "HEAD is tagged: %r", on_tag)
157
159
 
160
+ ccount = count_since(tag_sha, root=root)
161
+ log.log(INFO, "Commits count between HEAD and last tag: %r", ccount)
162
+
163
+ if tag_formatter is not None:
164
+ tag_format_callback = create_tag_formatter(tag_formatter, package_name=package_name, root=root)
165
+ tag = tag_format_callback(tag)
166
+ log.log(DEBUG, "Tag after formatting: %r", tag)
167
+
158
168
  if version_file:
159
169
  log.log(INFO, "Checking for 'version_file'")
160
170
 
@@ -166,35 +176,44 @@ def version_from_git( # noqa: PLR0915, PLR0912, PLR0913, C901
166
176
  version_file_path,
167
177
  starting_version,
168
178
  )
169
- tag = None
179
+ file_tag = None
170
180
  else:
171
181
  log.log(INFO, "Reading version_file '%s' content", version_file)
172
- tag = version_file_path.read_text().strip() or None
182
+ file_tag = version_file_path.read_text().strip() or None
173
183
 
174
- if not tag:
184
+ if not file_tag:
175
185
  log.log(INFO, "File %r is empty", version_file)
176
186
  else:
177
- log.log(DEBUG, "File content: %r", tag)
178
- if not count_commits_from_version_file:
179
- return sanitize_version(tag)
187
+ log.log(DEBUG, "File content: %r", file_tag)
188
+
189
+ if prefer_tag and file_tag and tag:
190
+ log.log(
191
+ INFO,
192
+ "Both 'version_file' and a Git tag (%r) are present, and 'prefer_tag' is enabled: using the tag",
193
+ tag,
194
+ )
195
+ if file_tag and sanitize_version(file_tag) != sanitize_version(tag):
196
+ log.warning(
197
+ "Git tag %r and 'version_file' content %r are different: using the tag. "
198
+ "Update the version file to silence this warning",
199
+ tag,
200
+ file_tag,
201
+ )
180
202
 
181
- file_sha = get_latest_file_commit(version_file, root=root)
182
- log.log(DEBUG, "File SHA-256: %r", file_sha)
203
+ elif file_tag:
204
+ tag = file_tag
183
205
 
184
- ccount = count_since(file_sha, root=root) if file_sha else None
185
- log.log(INFO, "Commits count between HEAD and last version file change: %r", ccount)
206
+ if not count_commits_from_version_file:
207
+ return sanitize_version(tag)
186
208
 
187
- elif not head_sha:
188
- log.log(INFO, "Not a git repo, or repo without any branch")
209
+ file_sha = get_latest_file_commit(version_file, root=root)
210
+ log.log(DEBUG, "File SHA-256: %r", file_sha)
189
211
 
190
- elif tag_sha:
191
- ccount = count_since(tag_sha, root=root)
192
- log.log(INFO, "Commits count between HEAD and last tag: %r", ccount)
212
+ ccount = count_since(file_sha, root=root) if file_sha else None
213
+ log.log(INFO, "Commits count between HEAD and last version file change: %r", ccount)
193
214
 
194
- if tag_formatter is not None:
195
- tag_format_callback = create_tag_formatter(tag_formatter, package_name=package_name, root=root)
196
- tag = tag_format_callback(tag)
197
- log.log(DEBUG, "Tag after formatting: %r", tag)
215
+ elif not head_sha:
216
+ log.log(INFO, "Not a git repo, or repo without any branch")
198
217
 
199
218
  if not tag:
200
219
  log.log(INFO, "No source for version, return starting_version %r", starting_version)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setuptools-git-versioning
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: Use git repo data for building a version number according to PEP-440
5
5
  Author-email: dolfinus <martinov.m.s.8@gmail.com>
6
6
  License: MIT
@@ -82,8 +82,8 @@ between ``setuptools-git-versioning`` and other tools.
82
82
 
83
83
  - Only Git v2 is supported
84
84
 
85
- - Setuptools and `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backends are
86
- supported (no Poetry & others)
85
+ - Setuptools and build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_
86
+ (e.g. `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+) are supported.
87
87
 
88
88
  - Currently does not support automatic exporting of package version to a file for runtime use
89
89
  (but you can use ``setuptools-git-versioning > file`` redirect instead)
@@ -176,30 +176,29 @@ and then add new argument ``setuptools_git_versioning`` with config options:
176
176
 
177
177
  Commands are the same as above, plus ``python -m setup.py`` returns the same version.
178
178
 
179
- ``scikit-build-core``
180
- ~~~~~~~~~~~~~~~~~~~~~
179
+ ``dynamic-metadata``
180
+ ~~~~~~~~~~~~~~~~~~~~
181
181
 
182
- If your project uses the `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ build backend,
183
- add ``setuptools-git-versioning`` to ``build-system.requires``,
184
- mark the ``version`` field as dynamic,
185
- register the dynamic-metadata provider,
186
- and configure options under the usual ``[tool.setuptools-git-versioning]`` section:
182
+ For build backends supporting `dynamic-metadata <https://dynamic-metadata.readthedocs.io>`_ 0.4+,
183
+ select the registered provider in ``[[tool.dynamic-metadata]]``. For example, with
184
+ `scikit-build-core <https://scikit-build-core.readthedocs.io>`_ 1.0+:
187
185
 
188
186
  .. code:: toml
189
187
 
190
188
  [build-system]
191
- requires = [ "scikit-build-core", "setuptools-git-versioning>=3.0,<4", ]
189
+ requires = [ "scikit-build-core>=1.0", "dynamic-metadata>=0.4", "setuptools-git-versioning>=3.2,<4", ]
192
190
  build-backend = "scikit_build_core.build"
193
191
 
194
192
  [project]
195
193
  name = "mypackage"
196
194
  dynamic = ["version"]
197
195
 
198
- [tool.scikit-build.metadata.version]
199
- provider = "setuptools_git_versioning.scikit_metadata"
196
+ [[tool.dynamic-metadata]]
197
+ provider = "setuptools_git_versioning.dynamic_metadata"
200
198
 
201
199
  [tool.setuptools-git-versioning]
202
200
  enabled = true
203
201
 
204
- All options under ``[tool.setuptools-git-versioning]`` work exactly as the for ``setuptools`` backend.
205
- Inline configuration under ``[tool.scikit-build.metadata.version]`` is not supported.
202
+ The provider sets only ``version`` and reads options from ``[tool.setuptools-git-versioning]``.
203
+ Inline settings in ``[[tool.dynamic-metadata]]`` are not supported.
204
+ The provider itself has no runtime dependency on ``dynamic-metadata``.
@@ -6,6 +6,7 @@ setuptools_git_versioning/__main__.py
6
6
  setuptools_git_versioning/archival.py
7
7
  setuptools_git_versioning/cli.py
8
8
  setuptools_git_versioning/defaults.py
9
+ setuptools_git_versioning/dynamic_metadata.py
9
10
  setuptools_git_versioning/factories.py
10
11
  setuptools_git_versioning/git.py
11
12
  setuptools_git_versioning/log.py
@@ -4,5 +4,8 @@ setuptools-git-versioning = setuptools_git_versioning.cli:main
4
4
  [distutils.setup_keywords]
5
5
  setuptools_git_versioning = setuptools_git_versioning:parse_config
6
6
 
7
+ [dynamic_metadata.provider]
8
+ setuptools_git_versioning.dynamic_metadata = setuptools_git_versioning.dynamic_metadata
9
+
7
10
  [setuptools.finalize_distribution_options]
8
11
  setuptools_git_versioning = setuptools_git_versioning:infer_version