Pyrex is a Python-like language for rapidly and easily writing python extension modules. It can be described as python with C data types. With Pyrex, one can produce Python-like code that runs as fast as in C, with easy access to C libraries and functions.
The Pyrex homepage is at http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
The two main uses of Pyrex are:
- To speed up the execution of Python code
- To provide a Python interface to existing C modules/libraries
There is an enhanced fork of Pyrex, called Cython. It features substantial performance optimisations and improved support for newer Python language features.
PyrexOnWindows provides a step-by-step guide to Pyrex installation on Windows.
For accessing existing C libraries, the ctypes module is also available in Python 2.5 and above.