Contribute Media
A thank you to everyone who has made this possible: Read More

Call C code quickly and compatibly with CFFI

Description

Have you ever wanted to speed up a slow part of your Python program by rewriting part of it in C? Maybe you needed to use a C/C++ library, but couldn’t find a Python binding? This talk will get you started with CFFI, a modern approach to calling into C code from Python. CFFI (FFI stands for ‘foreign function interface’) produces modules that work across interpreters and language versions. You won't need to write wrappers in a third language like SWIG or Cython, and you'll get better performance than with ctypes.

I'll walk through the creation of a library which wraps a C data structure, showing tips and tricks for rapid development, and how to avoid potential pitfalls. I'll also touch on how to interface with system libraries from Python, using CFFI to generate safe and fast bindings.

Details

Improve this page