Skip to content

Commit

Permalink
Add an option to disable using trove-classifiers package
Browse files Browse the repository at this point in the history
As requested in pypa/setuptools#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.
  • Loading branch information
mgorny committed Nov 21, 2024
1 parent db197f4 commit 4165f90
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/validate_pyproject/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 4165f90

Please sign in to comment.