Python 3 Adoption for Web Apps

PythonAs highlighted recently by Alex Gaynor in his recent blog post ‘About Python 3’, it has now been five years since Python 3.0 was released. As Alex comments, it was widely expected that adoption of Python 3 was going to be a long process with a target date of roughly five years, although it is not completely clear how success is measured.

Though we have now reached five years since its release, there is still a great deal of concern in the Python community as to whether Python 3 can be deemed a success or not. When such questions are raised, the usual topics tend to be discussed. These topics are: the rate at which Python packages and projects are being converted to Python 3, the dissatisfaction with how changes have been made to bytes/unicode in Python 3, and how the continued release of Python 2 versions has held back adoption of Python 3.

Arguments aside, we at New Relic thought it would be interesting to draw on our available customer data and see what we can infer about the actual usage rates of various Python versions. While this data will not definitively indicate Python 3’s success or failure, it will provide a picture of how Python 3 is being used in production environments among New Relic customers.

It should be noted that we only started supporting Python 3 in September of 2013. We also only support Python 3.3 or later and not earlier Python 3 versions. This will limit our opportunity to pick up customers who are using Python 3, but even if it doesn’t give us a good idea of what is happening right now, we felt it would serve as a useful starting point for benchmarking how Python 3 adoption proceeds from this point forward.

Breakdown by Python Version

Pulling together the data we have about the particular Python version that each application reporting to New Relic is using, the results we get are as follows:

Python Version Breakdown

As is quite obvious (and expected), Python 2.7 dominates. Right now, Python 3 usage amongst our customers is a mere 0.58% of overall deployments. This is not a good sign for Python 3 adoption, but, as already stated, we haven’t supported Python 3 for very long either.

Python 2.7 details

Since Python 2.7 is the most popular version, we decided to look deeper into the particular patch revisions that are being used. Are Python users updating as new versions of Python with bug fixes and/or security fixes are released?

Python 2.7 Patch Levels

The last batch of security fixes was in Python 2.7.3, and it can be seen that the majority of New Relic customers are using at least that version.

The particular patch level revision being used is going to be largely dictated by which binary Python package the different Linux distributions provide. For example, the last LTS release of Ubuntu (12.04LTS) uses Python 2.7.3.

What about PyPy?

We officially added PyPy support in our most recent Python agent release in December 2013. This announcement was almost a formality as it has worked for quite some time and there were no known issues for those using it. In fact, a couple New Relic customers have been using PyPy for a while now. Announcing official support was an indication that we are now fully incorporating PyPy into our testing regime, that we are fully confident it works well, and that we will not break anything PyPy-specific with new releases.

In the case of PyPy, because the most recent releases are going to still report as Python 2.7, we can’t easily identify it in the above data. We don’t currently have a good way of identifying PyPy usage in general, which is something that we plan to address in the future. The best approach was to look at the Python modules different applications were using. Luckily, when using PyPy, it automatically imports the ‘__pypy__’ module as one of its built-in modules. Assuming we can rely on that, then we are able to identify a total of five PyPy installations within New Relic.

This tells us that, in addition to Python 3, we are still in the early days for PyPy adoption at this point. However, we need to keep in mind that we have only indicated official PyPy support for less than one month.

Looking Forward

Knowing that the Python community has a keen interest in Python 3 adoption rates, New Relic will continue to keep an eye on any trends and provide updates when we see anything that may be of interest.

For additional information on the history of and the issues around the transition to Python 3, we also highly recommend you read the Python 3 Q & A by Nick Coghlan of the Python Software Foundation.

Graham has been doing programming for over 25 years. He is the author of mod_wsgi, the leading Python web hosting solution for Apache and is a member of both the Python and Apache Software Foundations. He works on bringing New Relic to the Python world. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!