From f6c9fdb5489ab49856cb1f4c237f02651c16b05f Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Tue, 12 Nov 2024 10:17:49 +0000 Subject: [PATCH 1/2] Revert "Allow user to skip validation of pyproject.toml via env var" This reverts commit 913d50a130b3c92636978b1d0e0ace8c60c23a8e. --- setuptools/config/pyprojecttoml.py | 13 ------------- setuptools/tests/config/test_pyprojecttoml.py | 7 ------- 2 files changed, 20 deletions(-) diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index fb277f5b7a..15b0baa18e 100644 --- a/setuptools/config/pyprojecttoml.py +++ b/setuptools/config/pyprojecttoml.py @@ -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") diff --git a/setuptools/tests/config/test_pyprojecttoml.py b/setuptools/tests/config/test_pyprojecttoml.py index df27487d51..db40fcd23d 100644 --- a/setuptools/tests/config/test_pyprojecttoml.py +++ b/setuptools/tests/config/test_pyprojecttoml.py @@ -17,7 +17,6 @@ ) from setuptools.dist import Distribution from setuptools.errors import OptionError -from setuptools.warnings import SetuptoolsWarning import distutils.core @@ -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 From 36e945e5a12ed552b33c523ba8ede4fa5a38d553 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Tue, 12 Nov 2024 10:22:26 +0000 Subject: [PATCH 2/2] Add news fragment --- newsfragments/4746.feature.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 newsfragments/4746.feature.rst diff --git a/newsfragments/4746.feature.rst b/newsfragments/4746.feature.rst new file mode 100644 index 0000000000..a66da9e943 --- /dev/null +++ b/newsfragments/4746.feature.rst @@ -0,0 +1,2 @@ +Removed support for ``SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION``, as it +is deemed prone to errors.