File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -310,7 +310,6 @@ def from_data(
310
310
# Handle nested SCM configuration
311
311
312
312
scm_config = ScmConfiguration .from_data (scm_data )
313
-
314
313
return cls (
315
314
relative_to = relative_to ,
316
315
version_cls = version_cls ,
Original file line number Diff line number Diff line change @@ -228,6 +228,18 @@ def read_pyproject(
228
228
requires ,
229
229
)
230
230
231
+ setuptools_dynamic_version = (
232
+ defn .get ("tool" , {})
233
+ .get ("setuptools" , {})
234
+ .get ("dynamic" , {})
235
+ .get ("version" , None )
236
+ )
237
+ if setuptools_dynamic_version is not None :
238
+ warnings .warn (
239
+ f"{ path } : at [tool.setuptools.dynamic]\n "
240
+ "version = {attr = ...} is sabotaging setuptools-scm"
241
+ )
242
+
231
243
return pyproject_data
232
244
233
245
Original file line number Diff line number Diff line change @@ -126,3 +126,23 @@ def test_read_pyproject_with_given_definition(monkeypatch: pytest.MonkeyPatch) -
126
126
)
127
127
128
128
assert res .should_infer ()
129
+
130
+
131
+ def test_read_pyproject_with_setuptools_dynamic_version_warns () -> None :
132
+ with pytest .warns (
133
+ UserWarning ,
134
+ match = r"pyproject.toml: at \[tool\.setuptools\.dynamic\]\n"
135
+ r"version = {attr = \.\.\.} is sabotaging setuptools-scm" ,
136
+ ):
137
+ pyproject_data = read_pyproject (
138
+ _given_definition = {
139
+ "build-system" : {"requires" : ["setuptools-scm[simple]" ]},
140
+ "project" : {"name" : "test-package" , "dynamic" : ["version" ]},
141
+ "tool" : {
142
+ "setuptools" : {
143
+ "dynamic" : {"version" : {"attr" : "test_package.__version__" }}
144
+ }
145
+ },
146
+ }
147
+ )
148
+ assert pyproject_data .project_version is None
You can’t perform that action at this time.
0 commit comments