[PYTHON] Upgrade Travis CI pip

Happy New Year everyone. I look forward to working with you again this year.

Now, on New Year's Day 2014, pip 1.5 was released.

This version has some changes that are incompatible with previous versions. It seems that some people have been responding to this from the beginning of the new year, and thank you for your hard work.

At the moment, the version of pip installed in the Travis CI (https://travis-ci.org/) Python environment is 1.4.1, but upgrading to 1.5 is only a matter of time.

The following procedure is the idea that it would be easier to upgrade first because it will be upgraded anyway.

If you like, you can cut the fix-requrements branch from the devel equivalent branch in advance.

1. Add pip freeze to thebefore_script:entry in .travis.yml

The before_script: entry is the entry that runs just before the script: entry where the test body runs. Add pip freeze to this entry.

yaml:.travis.yml


before_script:
    - "pip freeze"

If requirements.txt exists, you can write pip freeze -r requirements.txt to make the output a little easier to see.

However, please note that pip freeze is different from pip install, and if you specify multiple files with -r, only the last specified file will be valid.

3. Commit the edited .travis.yml and run the test on Travis CI.

The purpose of this is to record the environment when the test passed with the default pip in the build log, so it is strongly recommended to commit once here.

4. Edit the before_install: entry in .travis.yml

before_install: is the entry that runs just before the ʻinstall:entry that doespip install` etc.

Add the following line to this entry:

yaml:.travis.yml


before_install:
    - "easy_install --version"
    - "pip freeze"
    - "travis_retry pip install -U setuptools"
    - "cd `mktemp -d`"
    - "travis_retry wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py"
    - "travis_retry python get-pip.py"
    - "cd $OLDPWD"
    - "pip --version"
    - "easy_install --version"

The following is a bulleted list.

5. Check pip changes and fix if necessary

See the pip Changelog (http://www.pip-installer.org/en/latest/news.html#changelog) for pip changes.

6. Commit your changes and run your tests on Travis CI.

If the test passes successfully, you are done.

Finally

With these changes, the latest releases of pip and setuptools (excluding development) are always applied.

At the same time, the list of installed module versions is now in the build log, which should be easier to isolate than looking at the pip install log when a test fails.

As an aside, it seems that before_script:" bundle show " is common in Ruby projects, but in Python projects .travis.yml contains pip freeze and pip list. I have never seen a case that I had. (By the way, 0 cases in .travis.yml of 106 files in 3585 modules that support Python 3.X on PyPI)

Travis CI seems to be a service whose site is built on Ruby, so it may be shunned by Pythonista.

Recommended Posts

Upgrade Travis CI pip
pip version upgrade
[Python] Automate Pelican builds with Travis CI
Accelerate CI by skipping unnecessary pip install
Install CVXOPT, NumPy, SciPy on Travis CI