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.

Files for pythran, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pythran-0.1.0.tar.gz (60.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page