English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# What's New in Python 2.7

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

- Multithreading
- Concurrent Requests
- Bytecode Modification
- Bytecode Upload
- Supported Datastore
- Django Version
- JSON Version
- PyCrypto Version
- PyYaml Version
- WebApp Version
- WebApp Templates
- Webob Version
- djangoforms Support
- zipimport Support
- Supported Third-Party Libraries
- Preferred Interface (WSGI vs. CGI)
- Support for C modules
- 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 (not recommended) | Supports only the High Replication datastore. If your application uses the Master/Slave datastore, you need to migrate it to High Replication.
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.
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. Python 2.7 supports the following third-party libraries and versions: django: 1.2 lxml: 2.3 numpy: 1.6.1 PIL: 1.1.7 pycrypto: 2.3 yaml: 3.10 webapp2: 2.3 webob: 1.1.1 jinja2: 2.6 markupsafe: 0.15 setuptools: 0.6c11 For instructions on specifying the latest version of any third-party library, see Using Python 2.7.
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 Using 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`