Fabien Maussion bio photo

Fabien Maussion

Climate, glaciers, and scientific programming.

The python 2 vs python 3 conundrum is at the origin of a myriad of blog posts and angry arguments on the web. I won’t repeat the arguments here (I gathered some links below), but I’ll jump on a deliberately provocative post by Matthias B., who concluded with the sentence:

“Remember, Legacy Python is responsible for global warming, encourage people to stay with IE6, and is voting for Donald Trump.”

Of course, this was meant to be a joke. But couldn’t Legacy Python indeed be responsible for a little share of global warming?

Continuous integration and the testing madness

Travis-CI is a tool which runs your tests for you. Whenever changes are made to the codebase, Travis-CI builds a test environment for your project, runs the tests, and warns you if something went wrong. This process (called “continuous integration”) is extremely useful for all kinds of projects, and is vital for large projects which can’t afford to publish buggy code.

But what does it have to do with py2? Since all major projects are supporting py2 and py3, they need to run their tests for both versions. Numpy for example uses 10 different environments, half of which is for py2. Each of these is going to need a bit of computational power every time someone pushes code. Multiply this by the number of projects using CI and you get a non-negligible amount of CPU time, used only for checking code compatibility with a legacy version of python.

I wasn’t able to find how much resources Travis-CI needs for its services. Obviously, this is not much in comparison to all other resources required to entertain us , but with these kind of arguments we can stop making efforts right now.

So, finally: yes, legacy python is hurting polar bears (a little bit).

Reading

On which side of the flame war are you? Obviously, I am on the condescending side (I can afford it: I started using python very late and I have no py2 codebase). However, py2 support won’t last forever (until 2020 to be precise), and the (voluntary) maintainers of several major scientific packages are about dropping py2 support long before that: