Skip to main content

PEP 440: Version Specifier Reference

Quick reference for version specifier syntax used in PEP 723 # /// script dependency blocks.

Quick Reference​

PatternExampleMatchesDoesn't Match
==pandas==1.5.31.5.3 only1.5.2, 1.5.4, 2.0
!=numpy!=2.0.0Any except 2.0.02.0.0
>matplotlib>3.03.0.1, 3.5, etc.3.0.0, 2.9
<scipy<2.01.9, 1.0, etc.2.0.0, 2.1
>=sklearn>=1.01.0, 1.5, 2.0, etc.0.9, 0.8
<=torch<=1.131.13, 1.12, 1.0, etc.1.13.1, 2.0
~=pydantic~=2.02.0, 2.1, 2.992.100+, 3.0

Example​

# /// script
# dependencies = [
# "pandas>=1.5,<2.0",
# "numpy~=1.24.0",
# ]
# ///

More Information​

  • PEP 440 — official version specifier specification