ANN: Cpyx 0.2
David N. Mashburn
david.n.mashburn at gmail.com
Thu Dec 10 01:12:37 EST 2015
Announcing Cpyx version 0.2
Cpyx is a utility to automatically build C and Cython code using either
distutils or command line cython and gcc. Numpy is supported in both cases.
The two core functions are cc and cpyx which compile c sources and
cython+c sources respecively.
* "cc" builds a shared library from all included inputs, using path
resolution and quoting to aid in debugging issues (gcc commands should
run verbatim from any directory).
* "cpyx" builds multiple c and cython sources into a python extension
Cpyx is quite simple (the main two functions are only ~100 lines of
code), so it is easy to fiddle with.
Cpyx.cpyx('some_file.pyx', ['one_file.c', 'another_file.c'])
Complete examples can be found here:
NEW IN VERSION 0.2:
*All functions were significantly overhauled and function names were
changed* (old Cdll and Cpyx/CpyxLib became "cc" and "cpyx" respectively).
Support for inlined cython code has been dropped since cython now
supports this automatically using "cython.inline".
New helpful utilities for extracting C function information (i.e. to
generate code using templates):
* get_function_raw_arguments -- Get all arguments as a single string
(everything inside the parentheses)
* get_function_args -- Get a string for each argument
* get_function_types_and_variables -- Get a list of [type, variable]
for each argument
* rebuild_function_signature -- Get a well-formatted version of the
full function signature
Ideally, Cpyx should work anywhere gcc, cython, and python/numpy are
The 0.1 branch was relatively well-tested and worked on Windows
(XP/Vista/7), Linux (Ubuntu), and Mac OS X (Leopard/Snow Leopard). The
0.2 branch has been pretty thoroughly tested on Ubuntu Linux, but let me
know if it does not work for you on any OS.
distutils may or may not work on Windows with mingw
I know there are other tools out there (most notably pyximport and
sage's misc/cython.py) to do this same kind of thing (and in much cooler
But Cpyx scratches my itch, so I thought I'd put it out there. Happy
This project supports work that I did at Vanderbilt University and am doing
at Pluralsight, LLC.
<P><A HREF="https://github.com/davidmashburn/cpyx">Cpyx 0.2</A> - A
gcc/cython/distutils wrapper for compiling Cython and C code directly
from python. (10-Dec-15)
More information about the Python-announce-list