checks.python_versions.PythonVersionsCheck

checks.python_versions.PythonVersionsCheck()

Check that requires-python excludes end-of-life Python versions.

Reads the Python constraint from pyproject.toml ([project] or Poetry), setup.cfg or setup.py and checks whether it allows any Python version that has reached end-of-life. A requires-python that the [project] table lacks or misstates is left to the metadata check.

Attributes

name :

The check identifier (“python_versions”).

description :

Human-readable description of this check.

rules :

The codes of the findings, each with what the rule means.

hints :

The same codes, each with what to do about the finding.

Methods

Name Description
run Check requires-python against EOL versions.

run

checks.python_versions.PythonVersionsCheck.run(package_path, config)

Check requires-python against EOL versions.

Parameters

package_path : Path

Path to the package directory to check.

config : dict[str, Any]

Configuration dictionary for this check.

Returns

: CheckResult

A CheckResult with:

: CheckResult
  • OK status if requires-python excludes all EOL versions
: CheckResult
  • NOTE status if requires-python allows EOL versions, or if a constraint kept in a legacy Poetry table, setup.cfg or setup.py cannot be interpreted or is not specified
: CheckResult
  • SKIPPED status if there is no value to check: requires-python is dynamic or computed in setup.py (“not-applicable”), or the metadata check reports why (“prerequisite-failed”). That is a pyproject.toml that is missing or cannot be read or has no [project] table, and a [project] table whose requires-python is missing or not a valid specifier.