I'm working on a Python application that is distributed as source (zipped) and via py2exe (majority).
Now I want to speed up some modules by replacing them with C extensions. Which works quite well for the development part. But the distribution and organization gives me a headache...
My current structure looks like this:
.
|-- py_submodule_a/
|-- py_submodule_b/
| |-- c_extension_ba/
|-- c_extension_x/
|-- setup.py
|-- main.py
My question is, where should I place the setup calls/files for my C extensions? I want to make sure that I can always run my application via main.py
(so I'd rather not wait until distribution to compile the C extensions) but I also want to make sure that the distribution always has the latest C extensions.
Thanks in advance for any help!
If you're just trying to optimize out hot-loops with C-code snippets you could always try something like scipy.weave. It is extremely convenient to have the C-code nicely wrapped up in the python package that calls it, and to be able to perform efficient C operations on memory in place.