CIO

Python 3 gains a big helping of library support

Python 3 will overtake Python 2 in library support in a few months, according to Microsoft's statistical analysis

Pity the poor Python 3 programmers who chose the latest version of the language and found that many of their favorite libraries are only compatible with Python 2.

Fortunately for them, more Python 2-only libraries have become cross-compatible with both versions. And according to Microsoft's Python Engineering team, the sun may set on the "sorry, no Python 3 spoken here" world sooner than we thought.

Microsoft harvested data about Python compatibility for libraries currently registered with PyPI (Python Package Index), the default repository for third-party Python libraries. After crunching the numbers, the group came up with two takeaways.

pypi chart 1 Python Engineering at Microsoft

Over the past five years, the number of Python 3-ready projects has risen steadily -- and the number of Python 2-only projects has declined just as steadily

First: Not only was support picking up for Python 3 -- that is, more existing Python 2 libraries were becoming Python 3 compatible -- but Python 2-only support was on a steep decline. From February 2011 through February 2016, Python 2-only support for PyPI packages dropped from a high of 80 percent of all packages to a low of about 20 percent.

The other discovery was that Python 3 support will overtake Python 2 in short order. Based on the rate of uptake for Python 3 libraries and the rate of decline for Python 2-only libraries, the Microsoft team predicted that 3 will overtake 2 by "around May of this year."

Over the last couple of years, the pace of Python 3 adoption has accelerated notably. In the Linux world, Fedora, Debian, and Ubuntu have opted to make Python 3 their default version of the language. OpenStack, written mainly in Python, has an ongoing initiative to port to Python 3.

Aside from Microsoft's work, there have been other efforts to track Python 3 progress. Py3readiness.org, a site that tracks the Python 3 status of the most popular Python packages, reports that 321 of the top 360 Python packages can be used with Python 3. A few high-profile stragglers remain, like MySQL-python, ansible, and Fabric, but the vast majority of the top projects are Python 3-ready.

Python 2 will stop receiving updates and maintenance after 2020. The deadline was extended from 2015 after it became clear the pace of conversion to Python 3 wasn't what language creator Guido van Rossum hoped for.