Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I build Python CFFI modules during development?

What are best practices for building CFFI modules during development?

Right now I'm using a Makefile:

mylib/_ffi.so: my_lib/build_ffi.py
    python $<

And then to test I can use:

$ make && python test.py

But this seems suboptimal. Is there a better way of building CFFI modules during development?

like image 628
David Wolever Avatar asked Nov 09 '22 11:11

David Wolever


1 Answers

If the project is using setuptools, python setup.py develop appears to build the library in-place:

$ python setup.py develop
...
Finished processing dependencies for my-lib==0.1
$ ls my_lib/
_ffi.so
...

But it doesn't seem like there is a make clean equivilent (setup.py clean only cleans the build/ directory), so it isn't quite ideal.

like image 126
David Wolever Avatar answered Nov 15 '22 13:11

David Wolever