Caching packages downloaded by "pip"

Downloading Python packages using the pip installer can be a pain in the ass mainly when you have to install the same packages in distinct "virtualenvs" and your Internet connection is slow or PyPI servers are quite busy. Anyway, caching is always a faster solution, right?

So, to deal with it I've setup pip to cache each package downloaded by it. The most straight way to do it is by using the parementer --download-cache:

1
pip install --download-cache ~/.cache/pip django

But you don't want type this long command over and over... Well, so just set the environment variable PIP_DOWNLOAD_CACHE to ~/.cache/pip or to whatever you want.

I personally prefer setup it globally, by configuring ~/.pip/pip.conf with the content below:

1
2
3
# ~/.pip/pip.conf
[global]
download_cache = ~/.cache/pip

trash-cli: command line trashcan utility

trash-cli provides a command line interface trashcan utility compliant with the FreeDesktop.org Trash Specification. It remembers the name, original path, deletion date, and permissions of each trashed file.

Definitely is a great tool for GNU/Linux. I’ve bind it to rm using a alias as the follows:

1
alias rm='trash-put -v'

You can restore deleted files using the command line as well:

1
$ restore-trash

More information on trash(1) and restore-trash(1) manual pages.