Skip to main content

A Python Just-In-Time compiler for astrophysical computations

Project description

HOPE is a specialized method-at-a-time JIT compiler written in Python for translating Python source code into C++ and compiles this at runtime. In contrast to other existing JIT compliers, which are designed for general purpose, we have focused our development of the subset of the Python language that is most relevant for astrophysical calculations. By concentrating on this subset, HOPE is able to achieve the highest possible performance.

By using HOPE, the user can benefit from being able to write common numerical code in Python and having the performance of compiled implementation. To enable the HOPE JIT compilation, the user needs to add a decorator to the function definition. The package does not require additional information, which ensures that HOPE is as non-intrusive as possible:

from hope import jit

def sum(x, y):
    return x + y

The HOPE package has been developed at ETH Zurich in the Software Lab of the Cosmology Research Group of the ETH Institute of Astronomy, and is now publicly available at GitHub.

Further information on the package can be found in our paper, on and on our website.

Python versions supported

Hope supports Python versions from 2.7 up to 3.6.


The package has been uploaded to PyPI and can be installed at the command line via pip:

$ pip install hope

Or, if you have virtualenvwrapper installed:

$ mkvirtualenv hope
$ pip install hope


0.7.0 (2017-09-08)

  • Support for Python 3.5 and 3.6

0.6.1 (2016-07-04)

  • fixing bug when accessing class members for operations

0.6.0 (2016-04-19)

  • Fixed bug in 2d array slicing

  • Array slicing with negative index

  • Fixed name clash bug with object attributes

  • Replaced assignment with reference to object attributes

0.5.0 (2016-01-20)

  • Fixed memory leak when creating array in jitted fkt

  • Fixed incorrect bound handling in numpy.interp

0.4.0 (2015-02-04)

  • Increased compilation speed for large functions

  • Support for variable allocation within if-else

  • Added support for numpy.sign

  • Updated Cython implementation in benchmarks

  • Fixed array allocation problem under OSX Yosemite (thx iankronquist)

0.3.1 (2014-10-24)

  • Better support for Python 3.3 and 3.4

  • Proper integration in Travis CI

  • Improved support for Linux systems (accepting x86_64-linux-gnu-gcc)

  • Avoiding warning on Linux by removing Wstrict-prototypes arg

  • Supporting gcc proxied clang (OS X)

  • Added set of examples

0.3.0 (2014-10-16)

  • Language: scalar return values

  • Shared libraries are written to hope.config.prefix

  • Function call can have return values

  • Fixed function calls to function with no arguments

  • Make sure code is recompiled if the python code has changed

  • Added config.optimize to simplify expression using sympy and replace pow

  • Speed improvements for hope

  • Added support for object properties

  • Added support for object methods

  • Addes support for True and False

  • Addes support for While

  • Addes support for numpy.sum

  • Addes support for numpy.pi

  • Added support for numpy.floor, numpy.ceil, numpy.trunc, numpy.fabs, numpy.log

  • improved error messages

  • Added config.rangecheck flag

  • Support xrange in for loop

  • Added cast operators for np.bool_, np.int_, np.intc, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64, np.float_, np.float32, np.float64,

  • Added bool operators

  • Added the following operators:


a // b


a % b


a << b


a >> b


a | b


a ^ b


a & b


a //= b


a **= b


a %= b


a <<= b


a <<= b


a | b


a ^ b


a & b

0.2.0 (2014-03-05)

  • First release on private PyPI.

0.1.0 (2014-02-27)

  • Initial creation.

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

hope-0.7.3.tar.gz (320.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page