How can I create Python CFFI modules during development?

What are the best practices for creating CFFI modules during development?

I am using Makefile now:

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

And then to check, I can use:

$ make && python test.py

But it seems suboptimal. Is there a better way to create CFFI modules during development?

+4
source share
2 answers

If the project uses setuptools, it python setup.py developappears 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 seems that there exists make cleanequivilent ( setup.py cleanonly clears the directory build/), so it is not entirely ideal.

+1
source

, "" , pytest make :

all: mylib/_ffi.so
    /usr/bin/python test.py

make.

0

All Articles