Deprecation Notice: Python 2.7 Support

In January 2020, the core CPython team sent out the following message:

We have decided that January 1, 2020, was the day that we sunset Python 2. That means that we will not improve it anymore after that day, even if someone finds a security problem in it. You should upgrade to Python 3 as soon as you can.

This message was a long time coming - Python 3 was first released in 2008. The PyMongo driver added support for Python 3 in 2012 (in version 2.2). Nevertheless, migrations from users to Python 3, and of our own internal python development teams, did not start right away.

8 years later, we find that 75% of PyMongo downloads are Python 3, the most popular libraries have dropped support for Python 2, and there are numerous resources, tutorials, and tools available to make migrations easier (such as Porting Python 2 Code to Python 3 — Python 3.11.2 documentation).

Yet some of our users are still using Python 2 in applications and we want to be sensitive to their upgrade timelines. At the same time we do not want to over-invest in a version of Python that has been end of lifed. Therefore, starting with version 4.0, PyMongo will not be compatible with Python 2.

If you have any questions or feedback on this, please reach out.

Thank you!!
Rachelle

2 Likes