Monday, November 3, 2014

Python Tip of the Year: pip install --editable .

Let's say you're developing an application in Python. Being a good citizen you've created a file that describes your application.

Kind of like this:
from setuptools import setup

    author='Your name',
    description='Your app',
When developing an application you often want to install it into system/virtualenv site-packages directory. At the same time you don't want to run python install after every time you make a change. There is a simple solution.

Just cd into directory containing and run pip install --editable .

Slow motion instant replay: pip install --editable <period>. Trailing period is important.

Now your application is installed into site-packages via symlink (kind of) and you don't need to reinstall it after making a change. Just edit your code and site-packages will magically have a new version of your application.