<!DOCTYPE html> <html> <head> <title>PyPy - What is PyPy?</title> <meta http-equiv="content-language" content="en" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" content="PyPy Team" /> <meta name="description" content="PyPy" /> <meta name="copyright" content="MIT" /> <meta name="document-rating" content="general" /> <link rel="stylesheet" type="text/css" media="screen" title="default" href="css/site.css" /> <link rel="alternate" type="application/rss+xml" title="RSS Feed for PyPy" href="http://feeds.feedburner.com/PyPyStatusBlog" /> <link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.14.custom.css" /> <script type="text/javascript" src="https://use.typekit.com/hdt8sni.js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script> <script type="text/javascript" src="js/script2.js?bust=1"></script> </head> <body> <script type="text/javascript"> var _gaq = [['_setAccount', 'UA-7778406-3'], ['_trackPageview']]; if (document.location.protocol !== 'file:') { (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); })(); } </script> <div id="body-outer"><div id="body-inner"><div id="body" class="clearfix"> <div id="header"> <div id="menu-follow"> <div><a href="https://bitbucket.org/pypy/pypy"><img src="https://www.selenic.com/hg-logo/logo-droplets-25.png" width="14px" height="14px" /></a></div> <div><a href="http://feeds.feedburner.com/PyPyStatusBlog" title="Subscribe to the RSS Feed"><img src="https://feedburner.google.com/fb/lib/images/icons/feed-icon-12x12-orange.gif" alt="Subscribe to the RSS Feed" width="14px" height="14px" /></a></div> </div> <div id="logo"><a href="http://pypy.org"><img src="image/pypy-logo.png" alt="PyPy" height="110px" /></a></div> <hr class="clear-left" /> <div id="menu-sub"> <a href="index.html">Home</a> <span class="menu-sub-sep"> | </span> <a href="features.html">What is PyPy?</a> <span class="menu-sub-sep"> | </span> <a href="download.html">Download</a> <span class="menu-sub-sep"> | </span> <a href="compat.html">Compatibility</a> <span class="menu-sub-sep"> | </span> <a href="performance.html">Performance</a> <span class="menu-sub-sep"> | </span> <a href="http://doc.pypy.org">Dev Documentation</a> <span class="menu-sub-sep"> | </span> <a href="http://morepypy.blogspot.com">Blog</a> <span class="menu-sub-sep"> | </span> <a href="people.html">People</a> <span class="menu-sub-sep"> | </span> <a href="contact.html">Contact</a> <br /> </div> <hr class="clear" /> </div> <div id="content"> <div> <div id="main"> <h1 class="title">What is PyPy?</h1> <p>PyPy is a replacement for CPython. It is built using the RPython language that was co-developed with it. The main reason to use it instead of CPython is speed: it runs generally faster (see next section).</p> <p><strong>PyPy</strong> implements <strong>Python 2.7.13 and 3.5.3</strong>. It supports all of the core language, passing the Python test suite (with minor modifications that were already accepted in the main python in newer versions). It supports most of the commonly used Python standard library modules. For known differences with CPython, see our <a class="reference external" href="compat.html">compatibility</a> page.</p> <p>The following CPU architectures are supported and maintained:</p> <ul class="simple"> <li><a class="reference external" href="http://en.wikipedia.org/wiki/IA-32">x86 (IA-32)</a> and <a class="reference external" href="http://en.wikipedia.org/wiki/X86_64">x86_64</a></li> <li><a class="reference external" href="http://en.wikipedia.org/wiki/ARM">ARM</a> platforms (ARMv6 or ARMv7, with VFPv3)</li> <li><a class="reference external" href="https://de.wikipedia.org/wiki/PowerPC">PowerPC</a> 64bit both little and big endian</li> <li><a class="reference external" href="https://de.wikipedia.org/wiki/System/390">System Z (s390x)</a></li> </ul> <p>PyPy's x86 version runs on several operating systems, such as Linux (32/64 bits), Mac OS X (64 bits), Windows (32 bits), OpenBSD, FreeBSD. All non-x86 versions are only supported on Linux.</p> <p>If you are interested in helping to move forward, see our <a class="reference external" href="howtohelp.html">howtohelp</a> page.</p> <div class="section" id="the-main-features-of-pypy"> <h1>The main features of PyPy:</h1> </div> <div class="section" id="speed"> <h1>Speed</h1> <p>Our <a class="reference external" href="download.html#with-a-jit-compiler">main executable</a> comes with a Just-in-Time compiler. It is <a class="reference external" href="http://speed.pypy.org/">really fast</a> in running most benchmarks – including very large and complicated Python applications, not just 10-liners.</p> <p>There are two cases that you should be aware where PyPy will <em>not</em> be able to speed up your code:</p> <ul class="simple"> <li>Short-running processes: if it doesn't run for at least a few seconds, then the JIT compiler won't have enough time to warm up.</li> <li>If all the time is spent in run-time libraries (i.e. in C functions), and not actually running Python code, the JIT compiler will not help.</li> </ul> <p>So the case where PyPy works best is when executing long-running programs where a significant fraction of the time is spent executing Python code. This is the case covered by the majority of <a class="reference external" href="http://speed.pypy.org/">our benchmarks</a>, but not all of them – the goal of PyPy is to get speed but still support (ideally) any Python program.</p> </div> <div class="section" id="memory-usage"> <h1>Memory usage</h1> <p>Memory-hungry Python programs (several hundreds of MBs or more) might end up taking less space than they do in CPython. It is not always the case, though, as it depends on a lot of details. Also note that the baseline is higher than CPython's.</p> </div> <div class="section" id="stackless"> <h1>Stackless</h1> <p>Support for <a class="reference external" href="http://www.stackless.com/">Stackless</a> and greenlets are now integrated in the normal PyPy. More detailed information is available <a class="reference external" href="http://doc.pypy.org/en/latest/stackless.html">here</a>.</p> </div> <div class="section" id="other-features"> <h1>Other features</h1> <p>PyPy has many secondary features and semi-independent projects. We will mention here:</p> <ul> <li><p class="first"><strong>Other languages:</strong> we also implemented other languages that makes use of our RPython toolchain: <a class="reference external" href="https://bitbucket.org/cfbolz/pyrolog/">Prolog</a> (almost complete), as well as <a class="reference external" href="https://bitbucket.org/pypy/lang-smalltalk/">Smalltalk</a>, <a class="reference external" href="https://bitbucket.org/pypy/lang-js/">JavaScript</a>, <a class="reference external" href="https://bitbucket.org/pypy/lang-io/">Io</a>, <a class="reference external" href="https://bitbucket.org/pypy/lang-scheme/">Scheme</a> and <a class="reference external" href="https://bitbucket.org/pypy/lang-gameboy/">Gameboy</a>.</p> <p>There is also a Ruby implementation called <a class="reference external" href="http://topazruby.com/">Topaz</a> and a PHP implementation called <a class="reference external" href="http://www.hippyvm.com/">HippyVM</a>.</p> </li> </ul> </div> <div class="section" id="sandboxing"> <h1>Sandboxing</h1> <p>PyPy's <em>sandboxing</em> is a working prototype for the idea of running untrusted user programs. Unlike other sandboxing approaches for Python, PyPy's does not try to limit language features considered “unsafe”. Instead we replace all calls to external libraries (C or platform) with a stub that communicates with an external process handling the policy.</p> <table class="docutils"> <colgroup> <col width="100%" /> </colgroup> <tbody valign="top"> <tr><td><strong>Please be aware that it is a prototype only.</strong> <em>It needs work to become more complete, and you are welcome to help. In particular, almost none of the extension modules work (not even</em> <tt class="docutils literal">time</tt> <em>), and</em> <tt class="docutils literal">pypy_interact</tt> <em>is merely a demo. Also, a more complete system would include a way to do the same as</em> <tt class="docutils literal">pypy_interact</tt> <em>from other languages than Python, to embed a sandboxed interpreter inside programs written in other languages.</em></td> </tr> </tbody> </table> <p>To run the sandboxed process, you need to get the full sources and build <tt class="docutils literal"><span class="pre">pypy-sandbox</span></tt> from it (see <a class="reference external" href="download.html#building-from-source">Building from source</a>). These instructions give you a <tt class="docutils literal"><span class="pre">pypy-c</span></tt> that you should rename to <tt class="docutils literal"><span class="pre">pypy-sandbox</span></tt> to avoid future confusion. Then run:</p> <pre class="literal-block"> cd pypy/sandbox pypy_interact.py path/to/pypy-sandbox # don't confuse it with pypy/goal/pyinteractive.py! </pre> <p>You get a fully sandboxed interpreter, in its own filesystem hierarchy (try <tt class="docutils literal"><span class="pre">os.listdir('/')</span></tt>). For example, you would run an untrusted script as follows:</p> <pre class="literal-block"> mkdir virtualtmp cp untrusted.py virtualtmp/ pypy_interact.py --tmp=virtualtmp pypy-sandbox /tmp/untrusted.py </pre> <p>Note that the path <tt class="docutils literal">/tmp/untrusted.py</tt> is a path inside the sandboxed filesystem. You don't have to put <tt class="docutils literal">untrusted.py</tt> in the real <tt class="docutils literal">/tmp</tt> directory at all.</p> <p>To read more about its features, try <tt class="docutils literal">pypy_interact.py <span class="pre">--help</span></tt> or go to <a class="reference external" href="http://pypy.readthedocs.org/en/latest/sandbox.html">our documentation site</a>.</p> </div> </div> <div id="sidebar"> </div> </div> </div> </div></div></div> </body> </html>