Skip to content

Commit 57ed6f0

Browse files
authored
Revert "Allow user to skip validation of pyproject.toml via env var" (#4746)
2 parents 8f5559c + 36e945e commit 57ed6f0

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

newsfragments/4746.feature.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed support for ``SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION``, as it
2+
is deemed prone to errors.

setuptools/config/pyprojecttoml.py

-13
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ def load_file(filepath: StrPath) -> dict:
4141

4242

4343
def validate(config: dict, filepath: StrPath) -> bool:
44-
skip = os.getenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "false")
45-
if skip.lower() == "true": # https://github.com/pypa/setuptools/issues/4459
46-
SetuptoolsWarning.emit(
47-
"Skipping the validation of `pyproject.toml`.",
48-
"""
49-
Please note that some setuptools functionalities rely on the validation of
50-
`pyproject.toml` against misconfiguration to ensure proper operation.
51-
By skipping the automatic checks, you taking responsibility for making sure
52-
the file is valid. Otherwise unexpected behaviours may occur.
53-
""",
54-
)
55-
return True
56-
5744
from . import _validate_pyproject as validator
5845

5946
trove_classifier = validator.FORMAT_FUNCTIONS.get("trove-classifier")

setuptools/tests/config/test_pyprojecttoml.py

-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
)
1818
from setuptools.dist import Distribution
1919
from setuptools.errors import OptionError
20-
from setuptools.warnings import SetuptoolsWarning
2120

2221
import distutils.core
2322

@@ -395,9 +394,3 @@ def test_warn_tools_typo(tmp_path):
395394

396395
with pytest.warns(_ToolsTypoInMetadata):
397396
read_configuration(pyproject)
398-
399-
400-
def test_warn_skipping_validation(monkeypatch):
401-
monkeypatch.setenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "true")
402-
with pytest.warns(SetuptoolsWarning, match="Skipping the validation"):
403-
assert validate({"completely-wrong": "data"}, "pyproject.toml") is True

0 commit comments

Comments
 (0)