5

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?

David Wolever
  • 148,955
  • 89
  • 346
  • 502

2 Answers2

1

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.

David Wolever
  • 148,955
  • 89
  • 346
  • 502
0

Not a full answer, but a suggested improvement on your "suboptimal" solution would be to add the running of pytest into the make file, along the lines of:

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

which would allow you to just run make.

jim anderson
  • 26
  • 2
  • 2
  • 5