Skip to main content

a claimless python to c++ converter

Project description

======= Pythran =======

What is it?

Pythran is a python to c++ compiler for a subset of the python language. It takes a python module annotated with a few interface description and turns it into a native python module with the same interface, but (hopefully) faster.

Installation

  1. Gather dependencies:

    • Following the easy install way:

      $> PYTHONPATH=<my_prefix>/lib/python<my_version>/site-packages \
                      easy_install --prefix=<my_prefix> ply networkx
      $> sudo apt-get install libboost-python-dev
    • Following the debian way:

      $> sudo apt-get install libboost-python-dev python-ply python-networkx
  2. Use the install target from setup script, in source driectory:

    $> python setup.py install --prefix=<my_prefix>
  3. Write your environment in stone:

    $> export PYTHONPATH=<my_prefix>/lib/python<my_version>/site-packages
    $> export PATH=<my_prefix>/bin:$PATH

Basic Usage

A simple pythran input could be dprod.py:

#pythran export dprod(int list, int list)
def dprod(l0,l1):
        return sum([x*y for x,y in zip(l0,l1)])

To turn it into a native module, run:

$> pythran dprod.py

That will generate a native dprod.so that can be imported just like the former module.

Documentation

The user documentation is available in the MANUAL file.

The CLI documentation is available from the pythran help command:

$> pythran --help

The developper documentation is also available using pydoc. Beware, this is the computer science incarnation fo the famous Where’s Wally? game:

$> pydoc pythran
$> pydoc pythran.typing

License

See LICENSE file.

Contact

Praise, flame and cookies:

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

pythran-0.1.0.tar.gz (60.4 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