File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ Added support for the environment variable
2
+ ``SETUPTOOLS_DANGEROUSLY_SKIP_PYPROJECT_VALIDATION=true ``, allowing users to bypass
3
+ the validation of ``pyproject.toml ``.
4
+ This option should be used only as a last resort when resolving dependency
5
+ issues, as it may lead to improper functioning.
6
+ Users who enable this setting are responsible for ensuring that ``pyproject.toml ``
7
+ complies with setuptools requirements.
Original file line number Diff line number Diff line change @@ -41,6 +41,19 @@ def load_file(filepath: StrPath) -> dict:
41
41
42
42
43
43
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
+
44
57
from . import _validate_pyproject as validator
45
58
46
59
trove_classifier = validator .FORMAT_FUNCTIONS .get ("trove-classifier" )
Original file line number Diff line number Diff line change 17
17
)
18
18
from setuptools .dist import Distribution
19
19
from setuptools .errors import OptionError
20
+ from setuptools .warnings import SetuptoolsWarning
20
21
21
22
import distutils .core
22
23
@@ -394,3 +395,9 @@ def test_warn_tools_typo(tmp_path):
394
395
395
396
with pytest .warns (_ToolsTypoInMetadata ):
396
397
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
You can’t perform that action at this time.
0 commit comments