Tuesday, November 6, 2012

Upgrading to Python 2.7: simple and practical

We launched a major improvement to the Python runtime when we introduced support for Python 2.7 last February. It has since proven to be astonishingly popular – just a few months later more than half of all active Python applications on App Engine are using Python 2.7.

What’s so great about Python 2.7? It isn’t just a language update, it also includes a number of features that can help your apps run much more efficiently.

Increase efficiency with concurrent requests. Now a single frontend instance can handle multiple requests at the same time in separate threads. This means App Engine requires fewer frontend instances to handle the traffic, which can lead to significant cost savings.

Rapidly growing mobile gaming company Pocket Gems reduced the cost of running their front-end instances by 78% when they switched to to the Python 2.7 runtime. “We immediately saw a dramatic difference” said engineering director David Underhill  “We only need one third as many instances under Python 2.7 as we did under 2.5 to handle the same traffic”.

Move faster with more native C modules. In Python 2.7 we’ve added more native C modules to App Engine. Core libraries like cPickle run much faster than the equivalent pure Python library available in the Python 2.5 runtime.

Take advantage of popular third-party libraries like PIL and numpy. We’ve greatly expanded the number of third party libraries available for use in App Engine in Python 2.7. So far we’ve added the Python Imaging Library (PIL), lxml, numpy, and several others.

Best of all, upgrading won't require lots of code changes. “It was pretty straightforward,” says Underhill. “We had to be careful, but we ended up needing to change less than 0.4% of the code”.

If you're ready to make the switch, check out our migration guide, find out more about the other great features of the Python 2.7 runtime and get in-depth tips from the App Engine Python team by watching their talk on Migrating to Python 2.7 at Google I/O 2012.

- Posted by Andrew Jessup, Product Manager, Google App Engine

1 comment:

DF said...

The issue I have is we used app-engine-patch from back in the day.

What is the supported, non-deprecated webapp framework on Python 2.7?