Google App Engine

Differences Between Python 2.5 and 2.7

Support for Python 2.5 has been deprecated. While Google will support Python 2.5 applications in the App Engine production environment per our terms of service, the ability to create new Python 2.5 applications will be removed in January 2014, and eventually Python 2.5 support will be removed from the production environment. For more information, see our blog post announcing the deprecation and Migrating to Python 2.7.

This page describes the key differences between Python 2.5 and Python 2.7:

  1. Multithreading
  2. Concurrent Requests
  3. Bytecode Modification
  4. Bytecode Upload
  5. Supported Datastore
  6. Django Version
  7. JSON Version
  8. PyCrypto Version
  9. Python Imaging Library
  10. PyYaml Version
  11. WebApp Version
  12. WebApp Templates
  13. Webob Version
  14. djangoforms Support
  15. zipimport Support
  16. Supported Third-Party Libraries
  17. Preferred Interface (WSGI vs. CGI)
  18. Support for C modules
  19. Runtime version in app.yaml
Feature Python 2.5 Behavior Python 2.7 Behavior
Multithreading Not available.

You can use the Python 2.7 threading library. All threads in a request must finish before the request deadline (60 seconds for online requests and 10 minutes for offline).

Concurrent requests Not supported.

Can use concurrent requests as long as you specify the threadsafe directive in app.yaml. Script handlers must use the Python WSGI interface in order to be threadsafe.

In backends, raising an exception from a shutdown hook copies that exception to all threads.

Bytecode modification Not possible to modify bytecode because of restrictions in the runtime. No longer restricts access to Python bytecode. Libraries that generate or manipulate bytecode (such as the jinja2 templating library) can do so in this runtime. Applications can create, modify, and execute arbitrary bytecode. This can make some libraries more efficient (such as the jinja2 templating library), but if your application relies on the restrictions in Python 2.5 for security, you need to update it.
Bytecode upload Not available.

Can upload .pyc files, but not in combination with .py files. However, you can upload .zip files containing .py or .pyc files (or a combination).

Supported Datastore High Replication Datastore (preferred)
Master/Slave Datastore (deprecated)
Supports only the High Replication Datastore (HRD). If your application uses the Master/Slave Datastore, you need to migrate it to the HRD.
Django version Supports Django 0.96 and 1.2. Supports only Django 1.2. See Porting Your Apps from Django .96 to 1.2 for upgrade details. Django 1.2 automatically HTML-escapes the output of every variable. This may break some templates (but fixes some security bugs). For instructions on how to enable Django 1.2 in your application, see Third-party Python Libraries.
JSON version Supports simplejson. Uses the native JSON library, which is much faster than simplejson.
PyCrypto version Supports PyCrypto 2.0.1 with restrictions (see the PyCrypto documentation for more information). Supports PyCrypto 2.3 with C-accelerated public key encryption.
Supports PyCrypto 2.6.
Python Imaging Library Not supported. (Although PIL must be installed locally if you wish to use the App Engine Images API with the development server to support testing of your app.) Supported. You must declare the library in the libraries section of the app.yaml file.
(If you wish to use PIL or the App Engine Images API with the development server, you also need to install PIL locally.)
PyYaml version Version 3.0.5 Version 3.10. For differences, see the PyYaml documentation.
WebApp version google.appengine.ext.webapp is aliased to webapp1. google.appengine.ext.webapp is aliased to webapp2. The new version has excellent backward compatibility, but you still need to test your application thoroughly.
WebApp templates Supports WebApp templates WebApp templates are deprecated. Instead, you can use the third-party templating libraries packaged with the runtime (jinja2 or Django templates).
Webob version Supports WebOb 0.9. Supports WebOb 1.1.1. Version 1.1.1 is not fully backward-compatible with WebOb 0.9. If you are upgrading an application that uses WebOb 0.9, you need to test the WebOb functionality extensively and update your application for the new version.
djangoforms support djangoforms is directly supported as google.appengine.ext.db.djangoforms djangoforms is not supported but third-party alternatives such as WTForms can be used.
zipimport support zipimport is supported. zipimport is not supported, but Python 2.7 can natively import from .zip files.
Supported third-party libraries Supports the following third-party libraries and versions:
Django 0.96, 1.0, 1.1, 1.2
PyCrypto 2.0.1
PyYAML 3.05
WebOb 0.9
zipimport
The google.appengine.dist package has been removed, so methods like use_library() and webapp_django_version() are no longer available.
Preferred interface (WSGI vs. CGI) CGI is the only supported interface. WSGI is the preferred interface, and is required for multithreading. For more information about converting CGI handlers to WSGI, see Migrating to Python 2.7.
Support for C modules Some C modules are not available. See the libraries knowledge base for more information. The following C modules are not available:
ctypes, sqlite, ssl, _ssl, fcntl, spwd, pwd, grp, syslog, select, _socket
Runtime version in app.yaml runtime: python runtime: python27

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.