$ pyo3-ffi
v0.28.0Python-API bindings for the PyO3 ecosystem
Latest Update Summary
Crate
Name: pyo3-ffi New version: 0.27.0 Release date: 2025-10-19T11:17:23Z
Crate readme
Short description Rust bindings for Python, including tools for creating native Python extension modules.
Long description PyO3 allows developers to write native Python modules in Rust and embed Python in Rust binaries. It supports CPython 3.7+, PyPy 7.3, and GraalPy 24.2 or greater. Requires Rust 1.74 or greater.
Features • Python distributions support: CPython 3.7+, PyPy 7.3 (Python 3.11+), GraalPy 24.2 or greater (Python 3.11+) • Rust 1.74 or greater required • Cargo feature: extension-module • Cargo feature: auto-initialize
Code Examples Add to Cargo.toml
[dependencies]
pyo3 = { version = "0.27.0", features = ["extension-module"] }
Basic usage
use pyo3::prelude::*;
fn main() -> PyResult<()> {
Python::attach(|py| {
let sys = py.import("sys")?;
let version: String = sys.getattr("version")?.extract()?;
println!("Python version: {}", version);
Ok(())
})
}
Using maturin to create a package
$ python -m venv .env
$ source .env/bin/activate
$ pip install maturin
$ maturin init --bindings pyo3
$ maturin develop
Links • https://pyo3.hs • https://docs.rs/pyo3/ • https://github.com/PyO3/pyo3 • https://pyo3.rs/v0.27.0/migration.html
https://api.github.com/repos/PyO3/pyo3/releases/255595618
Release info
Release version: 0.27.0
Release description
This release introduces several noteworthy updates including the first testing of PyO3 against the final version of Python 3.14.0, continuing the seamless support that was initially rolled out in version 0.26 with release candidates. However, support for PyPy 3.9 and 3.10 has been dropped. The FromPyObject trait undergoes significant enhancements, having been reworked to align with the previous improvements to the IntoPyObject trait, providing a performant and flexible implementation. In an effort to enhance API usability, the .downcast() family of functions has been deprecated in favor of the new .cast() family which improves the clarity of error messages during conversion failures. Changes have also been applied to the operations on the PyCapsule type to remedy issues related to return value lifetimes. The capsule API now emphasizes the importance of validating capsule names to ensure proper data handling. Additional smaller features, bug fixes, and performance improvements have been made. For further assistance with these changes, users are directed to the migration guide.
Code Examples
Minor update: 0.27.2 → 0.28.0
$ DOWNLOADS TREND
$ VERSION HISTORY
$ LINKS
$ INSTALL
cargo add pyo3-ffiOr add to Cargo.toml: pyo3-ffi = "0.28.0"