[PYTHON] Accelerate CI by skipping unnecessary pip install

Thing you want to do

Travis CI testing is slow and I want to speed it up. Looking at the log, pip install is taking a long time. Especially numpy installation is slow. Also, I want to skip the fact that the installed package is processed every time because it is specified in the cache directory.

environment

.travis.yml


python:
- 2.7.9
cache:
  apt: true
  directories:
  - "$HOME/.pip-cache/"
  - "$HOME/virtualenv/python2.7.9"
before_install:
- sudo apt-get update
- sudo apt-get install XXX #Required package installation
install:
- pip install -r requirements.txt --download-cache $HOME/.pip-cache
#Omitted below

What i did

Change the install item so that the installation process runs only the difference compared to pip freeze

.travis.yml


install:
- pip freeze | comm -13 - requirements.txt | grep -v '^#' | xargs pip install --download-cache $HOME/.pip-cache

Task

The line installed by specifying tag from the git repository will always be a difference because the hash value of the commit is displayed in pip freeze.

Well, is it okay because the slowest numpy was skipped? I think.

Recommended Posts

Accelerate CI by skipping unnecessary pip install
Install by specifying the version with pip
sudo pip install
Install pip on Mavericks
Install pip, pyenv, BeautifulSoup4
How to install pip
Error with pip install
Upgrade Travis CI pip
Install the pip command
Install pip / pip3 on Ubuntu
Install scikit.learn with pip
When pip install fails