10aday › tools

requires-python checker: which Python versions does your specifier allow?

requires-python in pyproject.toml (PEP 621) tells pip which interpreters may install your package. It uses PEP 440 rules, and two of them surprise people: a short version is padded with zeros (<=3.12 means <=3.12.0), and there is no caret (^3.10 is Poetry syntax). Type a specifier to see every Python version from 2.7 to 4.0 that it accepts.

Green: every patch release (x.y.0 to x.y.40) is accepted. Yellow: only some. Grey: none. Runs in your browser; nothing is sent anywhere.

Common requires-python values

You writePython versions acceptedVerdict

This table is computed by the same engine as the checker when the page loads.

Upper bounds: why most libraries leave them out

A cap such as <3.13 is not a hint: pip will refuse to install that release of your package on Python 3.13, and older releases may get picked instead. Users cannot override it, and a new Python 3 minor version arrives every October, so a cap has to be raised every year. The long “Requires-Python upper limits” thread on discuss.python.org concludes that caps should be the exception. For an application you deploy yourself, a cap is less harmful. When you do cap, use <3.14, not <=3.13.

Coming from Poetry?

python = "^3.10" in [tool.poetry.dependencies] means >=3.10,<4.0. In [project] write requires-python = ">=3.10". To convert a whole file, use the Poetry to PEP 621 converter. The Poetry ^ and ~ guide explains each operator, and the pip ~= guide covers the compatible release operator. To compare a constraint across npm, Cargo, Composer, pip and RubyGems, try the Version Constraint Checker.

FAQ

What does requires-python = ">=3.10" mean?

pip will only install the package on Python 3.10.0 or newer, including every future release. It is the form most packaging guides recommend for libraries: a lower bound and no upper bound.

Why does requires-python = "<=3.12" reject Python 3.12.4?

PEP 440 pads the shorter version with zeros, so <=3.12 means <=3.12.0. Every patch release after 3.12.0 is excluded. Write <3.13 to allow all of 3.12.x.

Does requires-python = "==3.10" allow Python 3.10.12?

No. ==3.10 is compared as ==3.10.0, so only 3.10.0 matches. Use ==3.10.* (or >=3.10,<3.11) for any 3.10.x.

Can I write ^3.10 in requires-python?

No. The caret is Poetry syntax ([tool.poetry.dependencies] python = "^3.10"). In the standard [project] table you need PEP 440: ^3.10 becomes >=3.10,<4.0, and usually just >=3.10.

Should I put an upper bound on requires-python?

Usually not for a library. A cap such as <3.13 makes pip refuse to install the package on newer Python versions, users cannot override it, and a new Python 3 minor ships every October. Cap only when the code is known to break.

What does ~=3.10 mean in requires-python?

~=3.10 is a compatible release clause: >=3.10,<4. With three numbers, ~=3.10.2 means >=3.10.2,<3.11, which allows only Python 3.10.

Sources