Offline Python Packages using DevPi

As I am often travelling much of my work happens during train rides. To be independent of any Internet connection I set up a local DevPi server which caches all my package needs.

DevPi Server right at your Mac

If you read my previous post Don't mess with system's site-packages you should be prepared as you surely installed pipsi already, didn't you?

$ pipsi install devpi-server

Let's check if everything is at its place.

$ which devpi-server

From now on you are able to start you local DevPi server.

$ devpi-server

You can also launch it in the background as a daemon.

$ devpi-server --start

Assuming that you already created and activated a fresh virtualenv you can start installing some packages though your local DevPi server now:

$ pip install --index-url http://localhost:3141/root/pypi/+simple/ django

The lazy ones do not want to mention the index-url every time they are installing new packages and set up a local config file at their user's home directory.

# ~/.pip/pip.conf
index-url = http://localhost:3141/root/pypi/+simple/

There are also some other pip configuration options which are covered by pip's docs.

Even if your corporate internet is everything but fast I would advice you setting up and using a local DevPi server. This is especially useful at build environments which create a fresh setup on every build. Utilizing DevPi will result in huge speed ups.