Python pip and virtualenv

After working for a couple of years with Python and external dependencies I’ve ran again and again into the same kind of problems.

Bad habits

Say you have a global python installation under e.g. C:\Python27 on Windows. When you start working on your first python project you want to use external packages and you encounter pip as dependency management tool. (pip is part of the python installation since 2.7.9 / 3.4) So far so good.

But you keep installing all the packages into your global python installation. Continue reading “Python pip and virtualenv”

pip optional dependencies

Sometimes you want to make your python package usable for different situations, e.g. flask or bottle or django.

If You want to minimize dependencies You can use an optional dependency in

 'flask': ['Flask>=0.8', 'blinker>=1.1']

Now you can install the library with:

pip install raven[flask]