language: python
env:
  global:
    - PIP_DOWNLOAD_CACHE=$HOME/.pip_cache

matrix:
  include:
    - python: "2.7"
      env: TOX_ENV=py27
    - python: "3.4"
      env: TOX_ENV=py34
    - python: "3.5"
      env: TOX_ENV=py35
    - python: "3.6"
      env: TOX_ENV=py36
    - python: "3.7"
      env: TOX_ENV=py37
      dist: xenial
      sudo: required
    - env: TOX_ENV=flake8

cache:
  directories:
    - $HOME/.pip-cache/
install:
  - "travis_retry pip install setuptools --upgrade"
  - "pip install tox"
script:
  - tox -e $TOX_ENV
after_script:
  - cat .tox/$TOX_ENV/log/*.log

language: python
cache: pip

matrix:
  include:
    - python: "2.7"
      env: TOX_ENV=py27
    - python: "3.4"
      env: TOX_ENV=py34
    - python: "3.5"
      env: TOX_ENV=py35
    - python: "3.6"
      env: TOX_ENV=py36
    - python: "3.7"
      env: TOX_ENV=py37
      dist: xenial
      sudo: required
    - env: TOX_ENV=flake8

install:
  - "travis_retry pip install setuptools --upgrade"
  - "pip install tox"
script:
  - tox -e $TOX_ENV
after_script:
  - cat .tox/$TOX_ENV/log/*.log

Enable native pip cache in Travis CI
Enable native pip cache in Travis CI

Use the native Travis support. For more information, see:

https://docs.travis-ci.com/user/caching/#pip-cache
