Specify Python Version for Virtualenv in Requirements.txt

Specify Python Version for Virtualenv in Requirements.txt

Neither pip nor virtualenv install python (though pip tries). They use whatever you specify.

You could write a README that mentions required Python version or provide a fabric script that can deploy to localhost and specify the version there. For example, instructions to install virtualenv, pip, distribute.

For those people who dont read instructions there could be a CI system (jenkins, buildbot) that can run unit-tests using supported python versions (before/after commit).

To manage multiple python installation you could use something like pythonz.

it would be really convenient not to have to tell every new person
joining the team how to set up their virtualenv

Just add it to the normal set of instructions you give new members when the join; right in the same place when you tell them about the internal documentation wiki, the password to the wifi and the phone number to the sandwich delivery shop.

It will be extremely uncovenient to not have to tell people and have them figure it out themselves; the first time they submit something that uses collections.Counter only to find out it broke the build because the server doesnt have 2.7.x

Specify Python Version for Virtualenv in Requirements.txt

You cant put that in requirements.txt, but you can add this code at the top of the script:

import sys
if sys.version_info[0:2] != (2, 6):
    raise Exception(Requires python 2.6)

Leave a Reply

Your email address will not be published. Required fields are marked *