$ pyo3-ffi

v0.28.0

Python-API bindings for the PyO3 ecosystem

Downloads: 121.6M
Recent: 22.9M
Versions: 49
Updated: February 1, 2026

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

Linkshttps://pyo3.hshttps://docs.rs/pyo3/https://github.com/PyO3/pyo3https://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

92.8M121.6M

$ VERSION HISTORY

v0.28.0February 1, 2026
v0.27.2November 30, 2025
v0.27.1October 21, 2025
v0.27.0October 19, 2025
v0.26.0August 29, 2025

$ LINKS

$ INSTALL

cargo add pyo3-ffi

Or add to Cargo.toml: pyo3-ffi = "0.28.0"