Loading…

The final Python 2 release marks the end of an era

Article hero image

For you Python users who have been unwilling (or unable) to upgrade to version 3, there’s yet another reason to get motivated: python.org has released Python 2.7.18, the absolute last official release for Python 2.

While it doesn’t add much in terms of features, it does act as a milestone. This release comes after official support for version 2 ended—January 1st of this year—and serves as the final notice. No further releases will be coming, even if major security issues show up. So if you’ve been waiting on migrating, now might be a good time to put your plan into action.

Python is currently at version 3.8.2, as version 3 has been in active development since 2008. But because the two versions were incompatible, the adoption rate has been notoriously slow. Vicki Boykis reported that 40% of all packages downloaded from PyPI for September of 2019 were for version 2.7. Migrations of the code are no small feat, especially at organizations with massive codebases. Dropbox took three years from start to finish. Instagram spent 10 months.

The final countdown to this end of support was already pushed back five years. That’s an admission of sorts that the biggest issue—the incompatibility between the two versions—is magnified when you consider the libraries that people use. There’s an enormous ecosystem of libraries and tooling built up around the Python language, so any project will need to have access to updated libraries before they can even consider upgrading their main project code.

Depending on your needs, this may not push you to upgrade. If you’re running Python on an open server, there are some security issues that could give you pause. Up to to this point, Python has patched any significant security flaws found in its libraries, including one that affected its `ssl` implementation. That won’t happen for new flaws discovered from here on out.

Users who run local scripts, however, can use whatever they feel comfortable with. PyPy, an alternate implementation of Python, has agreed to support version 2 forever. Users who process large amounts of data mathematically may appreciate its speed gains and stick with the old version. To be fair, Python was never about speed. It’s an interpreted language, so it will usually be slower than the equivalent C program.

Even without official support, Python 2 could potentially receive security updates through a community effort. Alternate implementations like PyPy and Tauthon could follow the openJDK model: they have updated implementations of Java versions 6, 7, and 8, which have all reached their end-of-life points. If new security flaws are discovered in Python 2, these implementations could patch them.

Even outside of these alternate implementations, Python 2 may continue to receive updates thanks to a few operating systems that shipped it as an integral library. Red Hat has committed to support it through June 2024. Debian is actively trying to remove it, but will likely maintain support into 2024.

But that doesn’t mean you should wait. Any shiny new Python libraries are probably going to be written in Python 3. So if you want to make the most out of the developing ecosystem, you should upgrade now. You don’t want to be forced to upgrade when a killer security hole hits the internet.

In academic circles, Python 2 may live on for decades, just as COBOL has done within large sectors of government and industry. It’s grown quite popular there, thanks to its powerful data manipulation and visualization capabilities. Anecdotally, researchers are starting new projects with Python 2. And the scripts produced for research projects often become obsolete once the project ends. Why update something for a project already completed?

But if you’re an educator teaching Python 2 over 3, you’re doing your students a disservice. Python 3 will be adapted for the changing needs of software engineering, reacting to new concepts and use cases, while Python 2 will be mostly frozen in amber.

So while Python 2 may live on sometime into the future, this marks its final chapter. Chances are pretty good that, at some point soon, you’ll need to move on to Python 3. That’s probably a good thing, as Python 3 is still an actively developed language. Raise a glass (or a class) to the end of Python 2 and think about refactoring your code to take advantage of the new features coming out.

Add to the discussion

Login with your stackoverflow.com account to take part in the discussion.