Skip to content

Commit 0802e21

Browse files
SnoopJabravalheri
authored andcommitted
Emit warning for invalid [tools.setuptools] table
1 parent 75d21fe commit 0802e21

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

newsfragments/4150.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Emit a warning when ``[tools.setuptools]`` is present in ``pyproject.toml`` and will be ignored. -- by user:`SnoopJ`

setuptools/config/pyprojecttoml.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def read_configuration(
108108
if not asdict or not (project_table or setuptools_table):
109109
return {} # User is not using pyproject to configure setuptools
110110

111+
if "setuptools" in asdict.get("tools", {}):
112+
# let the user know they probably have a typo in their metadata
113+
_ToolsTypoInMetadata.emit()
114+
111115
if "distutils" in tool_table:
112116
_ExperimentalConfiguration.emit(subject="[tool.distutils]")
113117

@@ -439,3 +443,9 @@ class _ExperimentalConfiguration(SetuptoolsWarning):
439443
"`{subject}` in `pyproject.toml` is still *experimental* "
440444
"and likely to change in future releases."
441445
)
446+
447+
448+
class _ToolsTypoInMetadata(SetuptoolsWarning):
449+
_SUMMARY = (
450+
"Ignoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?"
451+
)

0 commit comments

Comments
 (0)