skillfed

cffi

Foreign Function Interface for Python calling C code.

cffi Permissive license MIT-0 Active 275 v2.1.1 released

Install

cffi on PyPI

pip

pip install cffi

uv

uv add cffi

poetry

poetry add cffi

Package facts

License MIT-0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — pycparser
Maintenance actively maintained — 10 days since the last release
Last repo commit
First released
Popularity one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: cffi-2.1.1-cp310-cp310-macosx_10_15_x86_64.whl; cffi-2.1.1-cp310-cp310-macosx_11_0_arm64.whl; cffi-2.1.1-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; cffi-2.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; cffi-2.1.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl; cffi-2.1.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl; cffi-2.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cffi-2.1.1-cp310-cp310-musllinux_1_2_aarch64.whl; cffi-2.1.1-cp310-cp310-musllinux_1_2_i686.whl; cffi-2.1.1-cp310-cp310-musllinux_1_2_x86_64.whl; cffi-2.1.1-cp310-cp310-win32.whl; cffi-2.1.1-cp310-cp310-win_amd64.whl; cffi-2.1.1-cp311-cp311-macosx_10_15_x86_64.whl; cffi-2.1.1-cp311-cp311-macosx_11_0_arm64.whl; cffi-2.1.1-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; cffi-2.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; cffi-2.1.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl; cffi-2.1.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl; cffi-2.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cffi-2.1.1-cp311-cp311-musllinux_1_2_aarch64.whl

Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Free Threading :: 2 - BetaProgramming Language :: Python :: Implementation :: CPython

About cffi

from the package's own PyPI description — quoted content, verbatim

GitHub Actions Status (image) PyPI version (image) Read the Docs (image)

CFFI

Foreign Function Interface for Python calling C code.

Please see the Documentation or uncompiled in the doc/ subdirectory.

Download

Download page

Source Code

Source code is publicly available on GitHub.

Contact

Mailing list

Testing/development tips

After git clone or wget && tar, we will get a directory called cffi or cffi-x.x.x. We call it repo-directory. To run tests under CPython, run the following in the repo-directory:

pip install pytest
pip install -e .  # editable install of CFFI for local development
pytest src/c/ testing/

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

CFFI enables Python code to call C functions directly by parsing C declarations and generating the necessary bindings, with a single runtime dependency on pycparser.

Medium install friction due to compiled wheels across many platforms (cp310, cp311 variants for Linux, macOS, Windows, and musl); active maintenance with a release 10 days ago and last commit on 2026-08-03 mitigates this.

MIT-0 (MIT No Attribution) is permissive and places no restrictions on use, modification, or distribution—suitable for any project.

Usage

pip install cffi
from cffi import FFI
ffi = FFI()
ffi.cdef("int add(int a, int b);")
C = ffi.dlopen(None)  # or path to compiled C library

Requires Python >=3.10; C library must be compiled and accessible via dlopen or similar mechanism.

Verdict: CFFI is a mature, actively maintained top-100 PyPI package with no known vulnerabilities and permissive licensing. Medium install friction from compiled wheels is offset by broad platform support and recent activity. Suitable for production use when calling C code is required.

Needs verification

  • Whether pycparser is bundled or must be installed separately as a runtime dependency.
  • Whether the package requires system C compiler toolchain for editable installs or only for building from source.
python c ffi bindingscall c code from pythonforeign function interfacec library wrapperpython c interopctypes alternativec function bindings

Similar packages