PyCCA provides compilers for C and x86 assembly that allow optimized routines to be compiled and executed at runtime with no external dependencies. PyCCA supports 32- and 64-bit intel/amd architectures on Linux, OSX, and Windows with python 2.7 or 3.4.
Current status: assembly compiler is beta, C compiler is alpha.
- PyCCA Assembler
- Assembly API Reference
- PyCCA C Compiler
Python is an excellent platform for numerical computing but relies heavily on compiled modules to provide optimized functions. For distributed packages, this either increases the burden on the developer to produce compiled binaries for a variety of platforms, or increases the burden on the end user to compile the package or its binary dependencies. Consequently, many Python developers avoid optimzed code, preferring instead to advertise “pure-python” as a feature of their packages.
The objective of pycca is to provide a pure-python approach that allows assembly and C functions to be compiled and executed at runtime with no external dependencies.
PyCCA allows assembler code to be compiled and executed within Python with no external dependencies. This works by:
- Allocating a block of memory with execute privileges.
- Compiling assembly instructions into machine code and writing to executable memory.
- Using the built-in ctypes package to create a python function that points to the compiled machine code.