Skip to main content

Runtime compiler for numerical Python.

Project description


Parakeet is a runtime accelerator for an array-oriented subset of Python. If you're doing a lot of number crunching in Python,
Parakeet may be able to significantly speed up your code.

To accelerate a function, wrap it with Parakeet's **@jit** decorator:


import numpy as np

def loopy_function(x, alpha = 0.5, beta = 0.3):
y = np.empty_like(x)
for i in xrange(len(x)):
y[i] = np.tanh(x[i] * alpha + beta)
return y

from parakeet import jit
fast_version = jit(loop_function)

x = np.array([1,2,3])
assert loopy_function(x) == fast_version(x)

def fast_comprehension(x, alpha = 0.5, beta = 0.3):
return np.array([np.tanh(xi*alpha + beta) for xi in x])

assert loopy_function(x) == fast_comprehension(x)

You should be able to install Parakeet from its [PyPI package]( by running:

pip install parakeet


Parakeet is written for Python 2.7 (sorry internet) and depends on:

* [treelike](
* [nose]( for unit tests
* [NumPy and SciPy](

Optional (if using the LLVM backend):

* [llvmpy](

Supported language features

Parakeet cannot accelerate arbitrary Python code, it only supports a limited subset of the language:

* Scalar operations (i.e. addition, multiplication, etc...)
* Control flow (if-statements, loops, etc...)
* Tuples
* Slices
* NumPy arrays (and some NumPy library functions)
* List literals (interpreted as array construction)
* List comprehensions (interpreted as array comprehensions)
* Parakeet's "adverbs" (higher order array operations like, parakeet.reduce)

How does it work?
Your untyped function gets used as a template from which multiple *type specializations* are generated (for each distinct set of input types). These typed functions are then churned through many optimizations before finally getting translated into native code. For more information about the project either check out our [HotPar slides]( from last year or contact the [main developer](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parakeet-0.16.tar.gz (189.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page