Travis CI is used by more and more open source Python projects to do their continous testing. scikit-learn is the latest project to adopt it.
With Travis, usually you'll use pip or setuptools to get your project's Python dependencies installed before running the test script. Here's the minimal .travis.yml example from the Travis docs for Python, one that will install dependencies using pip before it runs nosetests:
language:pythonpython:-"2.6"-"2.7"-"3.2"# command to install dependenciesinstall:"pipinstall-rrequirements.txt--use-mirrors"# command to run testsscript:nosetests
There is however some dependencies where this is problematic. Two of those are numpy and scipy, which contain a lot of C code that, with the method just discussed, needs to be compiled every time you run the Travis tests.
Travis allows you to install system packages through apt-get, which is quite cool. And there's already the binary python-numpy and python-scipy packages in Ubuntu, so why not use them?
The problem is that simply installing them via apt-get does not work for the same reason it doesn't work when you do this locally: The default virtualenv that Travis sets up for you to run the tests in is isolated from the system packages, so it won't see those globally installed numpy and scipy packages.
The solution for this is to use virtualenv with the --system-site-packages option, which allows you to import packages from your global site packages directory.
With Travis CI, you can create a separate virtualenv during before_install in the .travis.yml file. And then you activate and use it instead of the default one. Here's how it works:
before_install:-deactivate-virtualenv --system-site-packages ~/virtualenv/this-source ~/virtualenv/this/bin/activate-sudo apt-get install -qq python-numpy python-scipy
You can find scikit-learn's complete Travis configuration here: .travis.yml.