I have a Cython project containing several .pyx files. To distribute my project I would like to provide my generated .c files as recommended in the Cython documentation, to minimize problems with different Cython versions.
My current work flow is to build the project using:
me@machine$ python setup.py build_ext --inplace
This cythonizes (i.e. translate .pyx files to .c / .cpp files using Cython) all .pyx files and then compiles them. For a release I do not need the compiled (.so) files, so I basically ignore them. The problem is, I waste a lot of time with the useless compilation.
Is there a way to cythonize all .pyx files in the folder using the setup.py
, without compiling them?
$ cython my_file.pyx
I have about 20 .pyx files which have different compiler directives. Calling cython
on the command line for each file would be slower than just waiting for it to compile.
On the other hand creating a shell script to cythonize them would leave me with a second list of compiler directives that needs to be kept up to date. I would rather not do this, in order to keep my possible points of failure minimal.
One way to create the C files without compiling them is first remove in setup.py "setup(...)" line and replace it with only the "cythonize("*.pyx")" part. Then run:
me@machine$ python setup.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With