Enforcing python version in setup.py

The current best practice (as of this writing in March 2018) is to add a python_requires argument directly to the setup() call in setup.py:

from setuptools import setup

[...]

setup(name="my_package_name",
      python_requires=">3.5.2",
      [...]

Note that this requires setuptools>=24.2.0 and pip>=9.0.0; see the documentation for more information.

Leave a Comment