[TIP] Tox and setup.py enforcing python version

Roy Wright roy at wright.org
Tue Jun 2 12:14:54 PDT 2015


Howdy,

For my python3 apps I've been including the following to prevent them from being installed on python2:

import sys
if sys.version_info < (3, 3):
    print("appname requires python 3.3 or newer")
    exit(-1)

Now my system python is 2.7 (Ubuntu 14.04) so running tox will immediately fail even with:

[tox]
envlist = py33,py34

Removing the exit allows tox to run. 

I'm just curious what is the best practice here?  Run tox from python3 virtualenv? Let the user beware? Depend on classifiers?

TIA,
Roy


A free society is a single class society where everyone has the same rights.


More information about the testing-in-python mailing list