19👍
Update This is now a first class feature of Travis: http://blog.travis-ci.com/2013-12-05-speed-up-your-builds-cache-your-dependencies/
I’ve just been playing around with this, and it looks like you can cache the virtualenv site-packages like this (update the path to your python version):
cache:
directories:
- /home/travis/virtualenv/python2.7/lib/python2.7/site-packages
There’s a little issue that it doesn’t cache the bin
or the src
directories. I tried caching the whole virtualenv directory, but I get strange errors for dependencies installed via git into the src
directory.
You are still left with the problem of invalidating old requirements. if you remove something from the requirements, it will persist in the virtualenv so you either have to explicitly remove it with pip (pip remove foo
) or wait until Travis create an API to invalidate the cache…
The other option is to use the --download-cache
option for pip, then add that directory to the cache:
cache:
directories:
- $HOME/.pip-cache/
install:
- pip install -r requirements.txt --download-cache $HOME/.pip-cache
This will make the downloads faster, but it will still have to compile and install all of the requirements!
- Multiple lookup_fields for django rest framework
- Getting the request origin in a Django request
- How to dynamically add EC2 ip addresses to Django ALLOWED_HOSTS
6👍
With pip 7:
cache:
directories:
- $HOME/.pip-cache/
install:
- pip install --upgrade pip
- pip install -r requirements.txt --cache-dir $HOME/.pip-cache
- Validating a Django model field based on another field's value?
- Creating a Gin Index with Trigram (gin_trgm_ops) in Django model
- Django-rest-swagger nested serializers with readonly fields not rendered properly
- Removing the Label From Django's TextArea Widget
- Django_rest_swagger – 'staticfiles' is not a registered tag library. Must be one of: