Skip to content

Commit

Permalink
Revert "Allow user to skip validation of pyproject.toml via env var" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Nov 13, 2024
2 parents 8f5559c + 36e945e commit 57ed6f0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 2 additions & 0 deletions newsfragments/4746.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed support for ``SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION``, as it
is deemed prone to errors.
13 changes: 0 additions & 13 deletions setuptools/config/pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ def load_file(filepath: StrPath) -> dict:


def validate(config: dict, filepath: StrPath) -> bool:
skip = os.getenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "false")
if skip.lower() == "true": # https://github.com/pypa/setuptools/issues/4459
SetuptoolsWarning.emit(
"Skipping the validation of `pyproject.toml`.",
"""
Please note that some setuptools functionalities rely on the validation of
`pyproject.toml` against misconfiguration to ensure proper operation.
By skipping the automatic checks, you taking responsibility for making sure
the file is valid. Otherwise unexpected behaviours may occur.
""",
)
return True

from . import _validate_pyproject as validator

trove_classifier = validator.FORMAT_FUNCTIONS.get("trove-classifier")
Expand Down
7 changes: 0 additions & 7 deletions setuptools/tests/config/test_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
)
from setuptools.dist import Distribution
from setuptools.errors import OptionError
from setuptools.warnings import SetuptoolsWarning

import distutils.core

Expand Down Expand Up @@ -395,9 +394,3 @@ def test_warn_tools_typo(tmp_path):

with pytest.warns(_ToolsTypoInMetadata):
read_configuration(pyproject)


def test_warn_skipping_validation(monkeypatch):
monkeypatch.setenv("SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION", "true")
with pytest.warns(SetuptoolsWarning, match="Skipping the validation"):
assert validate({"completely-wrong": "data"}, "pyproject.toml") is True

0 comments on commit 57ed6f0

Please sign in to comment.