![]() |
|
Stable release | 1.8 / 10 February 2012 |
---|---|
Written in | Python |
Operating system | Cross-platform |
Type | Python interpreter and compiler toolchain |
License | MIT License |
Website | pypy.org |
PyPy is a Python interpreter and JIT compiler. PyPy focuses on speed, efficiency and 100% compatibility with the original CPython interpreter.
Contents |
Details and motivation
PyPy was conceived as an implementation of Python written in Python, which enables Python developers to hack the implementation. This makes it easy to identify areas where it can be improved. The fact that PyPy is implemented in a high level language makes it also more flexible and easier to experiment with than CPython, thus allowing developers to experiment with multiple implementations of specific features.
PyPy aims to provide a common translation and support framework for producing implementations of dynamic languages, emphasizing a clean separation between language specification and implementation aspects. It also aims to provide a compliant, flexible and fast implementation of the Python programming language using the above framework to enable new advanced features without having to encode low level details into it.[1]
Translation
PyPy consists of a standard interpreter and a translator.
The interpreter implements the full Python language utilizing a restricted subset, called RPython (Restricted Python). Unlike standard Python, RPython is statically typed, to allow efficient compilation.[2]
The translator is a tool chain that analyzes RPython code and translates it to a lower-level language, such as C, Java bytecode or Common Intermediate Language. It also allows for pluggable garbage collectors as well as optionally enabling Stackless. Finally it includes a JIT generator which builds a just-in-time compiler into the interpreter, given a few annotations in the interpreter source code. The generated JIT compiler is a tracing JIT[3].
Project status
The latest PyPy release, PyPy 1.8, is CPython 2.7.2 compatible. It runs on 32- and 64-bit Intel x86 architecture and includes a JIT compiler. It's tested nightly on Windows, Linux and Mac OS X. PyPy is able to run pure Python software that does not rely on implementation-specific features[4]. A translation for CPython C API extensions exists, but is incomplete and experimental. Interfacing with shared libraries is recommended via the ctypes infrastructure.
History
PyPy is a followup to the Psyco project, a just-in-time specializing compiler for Python, developed by Armin Rigo. PyPy's aim is to have a just-in-time specializing compiler with scope, which was not available for Psyco.
PyPy began as a research and development-oriented project. Reaching a mature state of development and an official 1.0 release in mid-2007, its next focus was on releasing a production-ready version with more CPython compatibility. Version 1.1 was released on April 28, 2009.[5] Many of PyPy's changes have been made during coding sprints.
As of late 2008, PyPy was able to run some popular Python libraries like Pylons[6], Pyglet[7], Nevow[8] and Django[9].
In March 2010, PyPy 1.2 was released, focusing on speed. It included a just-in-time compiler, which works, but was not advised to be run in production environments. Along with the 1.2 release, the website was redesigned and a new PyPy speed center[10] for tracking progress was brought up.
In December 2010, PyPy 1.4, the first PyPy suitable for production use was released. PyPy 1.4 is compatible with Python 2.5.
On April 30, 2011, PyPy 1.5 was released. PyPy 1.5 is compatible with Python 2.7.1.
On August 18, 2011, PyPy 1.6 was released.
On November 21, 2011, PyPy 1.7 was released.
On February 10, 2012, PyPy 1.8 was released, compatible with Python 2.7.2.
Funding
PyPy was funded by the European Union as a Specific Targeted Research Project[11] between December 2004 and March 2007. In June 2008, PyPy announced funding as part of the Google Open Source programs, and has agreed to focus on making PyPy more compatible with CPython. In 2009 Eurostars, a European Union funding agency specially focused on SMEs[12], accepted a proposal from PyPy project members entitled: "PYJIT - a fast and flexible toolkit for dynamic programming languages based on PyPy". Eurostars funding will last until August 2011. [13] At PyCon US 2011, the Python Software Foundation provided a $10,000 grant for PyPy to continue work on performance and compatibility with newer versions of the language[14]. The PyPy project also accepts donations through its status blog pages. [15]
Supported backends
- C - the RPython code can be translated to C and run as a native program, and this is the standard operation mode;
- CLI - Common Language Interface;
- JVM - Java Virtual Machine;
As of 2010, PyPy has abandoned its JavaScript backend.[16]
See also
- Bootstrapping (compilers)
- Cython
- Psyco
- Self-hosting
- Self-interpreter
- Rubinius Ruby implementation in Ruby
Notes
- ^ Samuele Pedroni (March 2007). "PyPy - Goals and Architecture Overview". http://codespeak.net/pypy/dist/pypy/doc/architecture.html#mission-statement.
- ^ "It is a proper subset of Python, restricted in a way that enables easy analysis and efficient code generation", Ancona et al., 2007.
- ^ Bolz et al., 2009
- ^ "PyPy - Python compatibility". http://pypy.org/compat.html.
- ^ "PyPy Status Blog: 1.1 final released". http://morepypy.blogspot.com/2009/04/11-final-released.html.
- ^ "Running pylons on top of PyPy". http://morepypy.blogspot.com/2008/06/running-pylons-on-top-of-pypy.html.
- ^ "Running Pyglet on top of PyPy". http://morepypy.blogspot.com/2008/02/running-pyglet-on-pypy.html.
- ^ "Running Nevow on top of PyPy". http://morepypy.blogspot.com/2008/06/running-nevow-on-top-of-pypy.html.
- ^ "PyPy runs unmodified django 1.0 beta". http://morepypy.blogspot.com/2008/08/pypy-runs-unmodified-django-10-beta.html.
- ^ "PyPy speed center". http://speed.pypy.org/.
- ^ "EU Community Research and Development Information Service Entry". http://cordis.europa.eu/search/index.cfm?fuseaction=proj.document&PJ_RCN=7746170.
- ^ "Eurostars - Aim Higher". http://www.eurostars-eureka.eu/.
- ^ "Project Page on Eureka Network". http://www.eurekanetwork.org/project/-/id/4791.
- ^ "A thank you to the PSF". http://morepypy.blogspot.com/2011/03/thank-you-to-psf.html.
- ^ "PyPy Status Blog: Oh, and btw: PyPy gets funding through "Eurostars"". http://morepypy.blogspot.com/2010/12/oh-and-btw-pypy-gets-funding-through.html.
- ^ Re: [pypy-dev] pypy appears to have entirely removed all mention of javascript back-end support from web site, By Maciej Fijalkowski, 22 Apr 2009, pypy-dev
References
- Davide Ancona, Massimo Ancona, Antonio Cuni, Nicholas D. Matsakis, 2007. RPython: a Step Towards Reconciling Dynamically and Statically Typed OO Languages. In Proc. Dynamic Language Symposium (DLS), 2007. ACM Press.
- Carl Friedrich Bolz, Antonio Cuni, Maciej Fijalkowski, 2009. Tracing the meta-level: PyPy's Tracing JIT Compiler. In Proc. ICOOOLPS, 2009. ACM Press.
- Corbet, Jonathan (May 19, 2010). "PyPy: the other new compiler project". LWN.net. http://lwn.net/Articles/388160/.
- Corbet, Jonathan (May 11, 2011). "A brief experiment with PyPy". LWN.net. http://lwn.net/Articles/442268/.
- von Eitzen, Chris (November 21, 2011). "PyPy 1.7 widens the performance "sweet spot"". The H (Heinz Heise). http://www.h-online.com/open/news/item/PyPy-1-7-widens-the-performance-sweet-spot-1382249.html.
- Rose, John (December 02, 2011). "A Day with PyPy". Oracle Corporation. http://blogs.oracle.com/jrose/entry/a_day_with_pypy.
- Gaynor, Alex (August 12, 2011). "Quora is now running on PyPy". Quora. http://www.quora.com/Alex-Gaynor/Posts/Quora-is-now-running-on-PyPy.
External links
- Official website
- Official status blog
- PyPy nightly benchmark run
- Python in Python: The PyPy System - technical talk by the designer of PyPy (video archive)
|