PyPy
![]() | |
Stable release | 1.3
/ June 25, 2010 |
---|---|
Repository | |
Written in | Python |
Operating system | Cross-platform |
Type | Python interpreter and compiler toolchain |
License | MIT License |
Website | http://pypy.org |
PyPy is a self-hosting interpreter for the Python programming language.
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, emphasising 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 is a meta-circular evaluator implementing the full Python language in 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.3, is CPython 2.5 compatible. It runs on 32-bit Intel x86 architecture and includes a JIT compiler. PyPy is able to run pure Python software that does not rely on implementation specific features[4]. The x86-64 architecture is not yet supported. 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]
As of late 2008, PyPy was able to run some popular Python libraries like Pylons[6], Pyglet[7], Divmod's Nevow[8] and Django[9].
In March 2010, PyPy 1.2 was released, focusing on speed. It includes a just-in-time compiler, which works, but is not advised to 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.
Funding
PyPy was funded by the European Union as a STReP[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.
Supported backend
- CLI - common language interface
- JVM - java virtual machine
- Python - PyPy is self-hosting
As of 2010, PyPy has abandoned its javascript backend.[12]
See also
- Bootstrapping (compilers)
- Self-hosting
- Self-interpreter
- Cython
- Psyco
- Rubinius Ruby implementation in Ruby
Notes
- ^ Samuele Pedroni (2007). "PyPy - Goals and Architecture Overview".
{{cite web}}
: Unknown parameter|month=
ignored (help) - ^ "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".
- ^ "PyPy Status Blog: 1.1 final released".
- ^ "Running pylons on top of PyPy".
- ^ "Running Pyglet on top of PyPy".
- ^ "Running Nevow on top of PyPy".
- ^ "PyPy runs unmodified django 1.0 beta".
- ^ "PyPy speed center".
- ^ "PyPy EU project page".
- ^ http://www.mail-archive.com/pypy-dev@codespeak.net/msg03946.html
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.