Contribute Media
A thank you to everyone who makes this possible: Read More

Building Bridges: Stopping Python 2 without damages


Deciding to stop support for Python 2 is a hard choice. As library authors we try to minimize the breakage for users. IPython recently moved from single-source to Python 3 only, and worked with Core Python to make such a transition possible and easy. We'll show you the new features available in pip/setuptools to make that easy for you, and tell you how the transition went for IPython.


Up until December 2016 it was hard if not impossible to mark a release of a Python package or library only compatible with some version of Python. Pip would happily download a Python 3 only version on Python 2 system, install it and break users systems.

After much work and patching many upstream project Python packagers can finally make user of the Requires-Python greater than or equal to 3.3 metadata, which will indicate to pip not to upgrade and thus shield most users from getting indecipherable error message from installing (or running) incompatible package versions.

While these changes should now be widely available, not all systems are fully up-to-date, and knowing how things can fails is necessary to packaging your libraries accordingly. We'll show you how to prepare for such a transition.

Finally we've release IPython 6.0 – using the above techniques – and have some numbers and our experience to share, for other to be ready if/when one of the library they know (or develop) is going to stop Python 2 support. Hopefully to do a tiny bit better than us.


Matthias Bussonnier is a Post Doctoral Scholar at the University of California Berkeley institute for data science and has been a core developer of IPython and Jupyter since 2012.


Improve this page