# 使用 Homebrew, apt 安装 cffi

查看 cffi 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:cffi
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install cffi
```

  证据: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install cl-cffi
```

  证据: Debian stable package indexes: cl-cffi from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

## 软件包事实

- **软件包键:** brew:cffi
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/cffi>
- **版本:** 2.1.0
- **来源摘要:** C Foreign Function Interface for Python
- **主页:** <https://cffi.readthedocs.io/en/latest/>
- **仓库:** <https://github.com/python-cffi/cffi>
- **上游文档:** <https://cffi.readthedocs.io/en/stable>
- **许可证:** MIT-0
- **源码归档:** <https://files.pythonhosted.org/packages/57/5f/ff100cae70ebe9d8df1c01a00e510e45d9adb5c1fdda84791b199141de97/cffi-2.1.0.tar.gz>
- **最后更新:** 2026-07-08T03:18:52Z
- **已生成:** 2026-07-10T07:20:53+00:00

## 可执行文件

- cffi-gen-src (cli)
- cffi-gen-src (别名)

## 依赖

- pycparser

## 构建依赖

- python@3.13
- python@3.14

## macOS 提供的库

- libffi

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sequoia, sonoma, tahoe, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-07-10
- 管理器版本: 2.1.0
- 管理器更新时间: 2026-07-08
- 本地数据: OK
- 上游仓库: https://cffi.readthedocs.io/en/latest/
- 信息: Release/tag comparison is only available for GitHub repositories.
## 项目历史与用法

CFFI is the C Foreign Function Interface for Python, used to call C libraries from Python with declarations that stay close to C header syntax. It occupies the practical middle ground between Python's ctypes, handwritten CPython extensions, and larger binding generators such as SWIG or Cython.

### 项目历史

The official documentation credits Armin Rigo and Maciej Fijalkowski and describes a design influenced by LuaJIT's FFI: users should mainly need to know C and Python, keep Python-related logic in Python, and choose between ABI-level and API-level access depending on portability and build needs.

PyPI lists the first cffi release, 0.1, on 2012-06-18. The 1.0.0 series in 2015 introduced the out-of-line generation model that became central to packaging CFFI-based wrappers with setuptools. Later releases continued to track newer CPython versions, PyPy use, wheels, platform support, and Python packaging changes.

### 采用历史

CFFI became especially important in PyPy culture because the official installation notes describe it as distributed with PyPy and as the recommended way to interface with C libraries there. On CPython, it is common in packages that need C library access without maintaining a large handwritten extension layer.

The package's official PyPI page shows sustained maintenance across many releases from 2012 through 2026, with current wheels for major CPython versions and platforms. Homebrew packages it because command-line and build workflows sometimes need the project tooling alongside Python package-manager installs.

### 使用方式

Typical usage starts with `from cffi import FFI`, a `cdef()` block copied or adapted from C declarations, and either `ffi.dlopen()` for ABI mode or `ffibuilder.set_source()` plus compilation for API mode. The official overview presents both in-line and out-of-line modes and recommends API mode when a C compiler is available.

CFFI is used to wrap existing shared libraries, compile small C wrapper modules, allocate C data from Python, pass buffers and structs, call function pointers, and expose Python functions to embedded interpreters.

### 为什么软件包爱好者会关心

CFFI is package-nerd significant because it changed the shape of Python native-library packaging: projects can describe a C interface in Python and let the build backend generate extension glue, instead of carrying a large CPython C API surface.

It is also a useful marker for interpreter-portable native bindings. Package maintainers care about whether a project uses CFFI because it affects wheels, build dependencies, PyPy compatibility, libffi availability, and whether downstream systems need compiler toolchains.

### 时间线

- 2012: PyPI lists cffi 0.1 as released on 2012-06-18.
- 2015: cffi 1.0.0 introduced out-of-line module generation.
- 2020: cffi 1.14.1 release notes say source hosting moved to Heptapod.
- 2025: PyPI lists cffi 2.0.0 as released on 2025-09-08.
- 2026: PyPI lists cffi 2.1.0 as released on 2026-07-06.

### Related projects

- CFFI is discussed by its docs alongside LuaJIT FFI, ctypes, Cython, SWIG, CPython native C extensions, PyPy, pycparser, and libffi.

### 来源

- <https://cffi.readthedocs.io/en/latest/whatsnew.html>
- <https://cffi.readthedocs.io/en/stable/>
- <https://cffi.readthedocs.io/en/stable/goals.html>
- <https://cffi.readthedocs.io/en/stable/installation.html>
- <https://cffi.readthedocs.io/en/stable/overview.html>
- <https://github.com/python-cffi/cffi>
- <https://pypi.org/project/cffi/>


## 安全说明

没有找到 cffi 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。


## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** cffi
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## 其他软件包管理器记录

- Debian apt - cl-cffi - 1:0.24.1-3: normalized package name match | Debian stable package indexes: cl-cffi from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Common Foreign Function Interface for Common Lisp | https://common-lisp.net/project/cffi/
- Ubuntu apt - cl-cffi - 1:0.24.1-3: normalized package name match | Ubuntu 24.04 LTS package indexes: cl-cffi from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Common Foreign Function Interface for Common Lisp | https://common-lisp.net/project/cffi/


## 相关链接

- [Language runtime packages](https://www.automicvault.com/zh-hans/pkg/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [Networking and protocol packages](https://www.automicvault.com/zh-hans/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [python@3.13](https://www.automicvault.com/zh-hans/pkg/brew/python-3-13/) - Build dependency declared by Homebrew.
- [python@3.14](https://www.automicvault.com/zh-hans/pkg/brew/python-3-14/) - Build dependency declared by Homebrew.
- [b4](https://www.automicvault.com/zh-hans/pkg/brew/b4/) - Popular package that depends on this formula.
- [checkov](https://www.automicvault.com/zh-hans/pkg/brew/checkov/) - Popular package that depends on this formula.
- [clingo](https://www.automicvault.com/zh-hans/pkg/brew/clingo/) - Popular package that depends on this formula.
- [cobo-cli](https://www.automicvault.com/zh-hans/pkg/brew/cobo-cli/) - Popular package that depends on this formula.
- [forbidden](https://www.automicvault.com/zh-hans/pkg/brew/forbidden/) - Popular package that depends on this formula.
- [jupyterlab](https://www.automicvault.com/zh-hans/pkg/brew/jupyterlab/) - Popular package that depends on this formula.
- [standardebooks](https://www.automicvault.com/zh-hans/pkg/brew/standardebooks/) - Both packages touch the same language runtime or ecosystem. Shared terms: cffi, pycparser, python.
- [tubeup](https://www.automicvault.com/zh-hans/pkg/brew/tubeup/) - Both packages touch the same language runtime or ecosystem. Shared terms: cffi, pycparser, python.

## Combined YAML source

View the package source record on GitHub. [combined/cffi.yml](https://github.com/automic-vault/db/blob/main/combined/cffi.yml)


## 来源

- Nucleus package database
- package-page enrichment
- curated package history
- package version freshness
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
