Skip to content

Commit 7b7971e

Browse files
committed
Set requirements attributes directly into dist when parsing pyproject.toml
1 parent 566f294 commit 7b7971e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

setuptools/config/_apply_pyprojecttoml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _set_config(dist: "Distribution", field: str, value: Any):
125125
setter(value)
126126
elif hasattr(dist.metadata, field) or field in SETUPTOOLS_PATCHES:
127127
setattr(dist.metadata, field, value)
128-
if hasattr(dist, field):
128+
else:
129129
setattr(dist, field, value)
130130

131131

@@ -212,12 +212,12 @@ def _dependencies(dist: "Distribution", val: list, _root_dir):
212212
if getattr(dist, "install_requires", []):
213213
msg = "`install_requires` overwritten in `pyproject.toml` (dependencies)"
214214
SetuptoolsWarning.emit(msg)
215-
_set_config(dist, "install_requires", val)
215+
dist.install_requires = val
216216

217217

218218
def _optional_dependencies(dist: "Distribution", val: dict, _root_dir):
219219
existing = getattr(dist, "extras_require", None) or {}
220-
_set_config(dist, "extras_require", {**existing, **val})
220+
dist.extras_require = {**existing, **val}
221221

222222

223223
def _unify_entry_points(project_table: dict):

0 commit comments

Comments
 (0)