Search code examples
pythonsvnversion-controleasy-installpip

Python package install using pip or easy_install from repos


The simplest way to deal with python package installations, so far, to me, has been to check out the source from the source control system and then add a symbolic link in the python dist-packages folder.

Clearly since source control provides the complete control to downgrade, upgrade to any branch, tag, it works very well.

Is there a way using one of the Package installers (easy_install or pip or other), one can achieve the same.

easy_install obtains the tar.gz and install them using the setup.py install which installs in the dist-packages folder in python2.6. Is there a way to configure it, or pip to use the source version control system (SVN/GIT/Hg/Bzr) instead.


Solution

  • Using pip this is quite easy. For instance:

    pip install -e hg+http://bitbucket.org/andrewgodwin/south/#egg=South
    

    Pip will automatically clone the source repo and run "setup.py develop" for you to install it into your environment (which hopefully is a virtualenv). Git, Subversion, Bazaar and Mercurial are all supported.

    You can also then run "pip freeze" and it will output a list of your currently-installed packages with their exact versions (including, for develop-installs, the exact revision from the VCS). You can put this straight into a requirements file and later run

    pip install -r requirements.txt
    

    to install that same set of packages at the exact same versions.