From 4165f9035a043ee9a515719297cf90d819ac3e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 21 Nov 2024 20:40:14 +0100 Subject: [PATCH] Add an option to disable using trove-classifiers package As requested in https://github.com/pypa/setuptools/issues/4459, add a VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS environment variable that can be used to disable using trove_classifiers package even if it is available. This can be used when the system features an outdated trove_classifiers, and therefore incorrectly triggers validation error. The change is designed to be absolutely minimal and non-intrusive. --- src/validate_pyproject/formats.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/validate_pyproject/formats.py b/src/validate_pyproject/formats.py index 1cf4a46..3d4ce6e 100644 --- a/src/validate_pyproject/formats.py +++ b/src/validate_pyproject/formats.py @@ -215,6 +215,9 @@ def trove_classifier(value: str) -> bool: """See https://pypi.org/classifiers/""" return value in _trove_classifiers or value.lower().startswith("private ::") + if os.getenv("VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS"): # pragma: no cover + raise ImportError() + except ImportError: # pragma: no cover trove_classifier = _TroveClassifier()