Call C code quickly and compatibly with CFFI
By Zack Voase

Get started calling C/C++ code from Python using CFFI. You'll learn the basics of speeding up critical parts of your program with native code and interacting with system libraries, all with minimal configuration overhead. The libraries produced will work in CPython and PyPy, and across Python 2 and 3.

Sunday 11:05 a.m.–11:30 a.m.

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.

Zack Voase

I’m Zack, and I’ve been involved in the Python and Django open-source communities since 2009. Right now I’m an engineer at Google in San Francisco, where I build software to track and optimize resource usage in our data centers. Before Google, I worked on analytics systems at Twitter and Dropbox, and most recently helped build Color Genomics’ website and lab software with Django. In my free time I love cooking BBQ, weightlifting, and hanging out with dogs.