NOAH KANTROWITZ

Heroku and CFFI 2014-07-22

UPDATE: This is no longer needed, the Python buildpack will install libffi for you if cffi or cryptography is present in your requirements.txt.

CFFI is a popular Python library to call C code from Python. Some major libraries that depend on it include:

buildpack-cffi allows any of these libraries to be installed and used in Heroku applications.

Usage

First set your BUILDPACK_URL to https://github.com/ddollar/heroku-buildpack-multi.git:

$ heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

Create the .buildpacks config for buildpack-multi:

$ cat .buildpacks
https://github.com/ddollar/heroku-buildpack-apt
https://github.com/coderanger/heroku-buildpack-cffi
https://github.com/heroku/heroku-buildpack-python

And then create the Aptfile config for buildpack-apt:

$ cat Aptfile
libffi-dev

Then just put the Python libraries you need in the normal requirements.txt.

If you are installing Cryptography, no additional configuration should be required.


Looking for an engineer? I'm looking for a new opportunity!

Back to articles