$ pyo3-build-config
v0.28.0Build configuration for the PyO3 ecosystem
Latest Update Summary
Crate
Name: pyo3-build-config 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 for writing native Python modules in Rust and embedding Python in Rust binaries. It supports CPython 3.7 and above, PyPy 7.3 and GraalPy 24.2 and above, requiring Rust 1.74 or greater. The library enables integration between Rust and Python code, making it usable from both languages.
Features • Supported Python distributions: CPython 3.7+, PyPy 7.3+, GraalPy 24.2+ • Requires Rust 1.74 or greater • Utilizes maturin for building and publishing Rust-based Python packages • Asynchronous support through pyo3-async-runtimes • Safety guarantees by leveraging Rust's features
Code Examples Add to Cargo.toml
[dependencies]
pyo3 = { version = "0.27.0", features = ["extension-module"] }
Basic usage
use pyo3::prelude::*;
use pyo3::types::IntoPyDict;
fn main() -> PyResult<()> {
Python::attach(|py| {
let sys = py.import("sys")?;
let version: String = sys.getattr("version")?.extract()?;
let locals = [("os", py.import("os")?)].into_py_dict(py)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME') or 'Unknown'", None, Some(&locals))?.extract()?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())
})
}
Using maturin to generate a package
$ mkdir string_sum
$ cd string_sum
$ python -m venv .env
$ source .env/bin/activate
$ pip install maturin
$ maturin init --bindings pyo3
$ maturin develop
Embedding Python in Rust
sudo apt install python3-dev
Links • https://github.com/PyO3/pyo3 • https://pyo3.rs • https://docs.rs/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 marks the first PyO3 version tested against Python 3.14.0 final, with no major changes to support since version 0.26. Notably, support for PyPy 3.9 and PyPy 3.10 has been removed as they are no longer supported upstream. The FromPyObject trait has been reworked to align with the IntoPyObject trait from PyO3 0.23, resulting in a more efficient and flexible implementation. The .downcast() functions have been deprecated in favor of the .cast() functions, improving usability and error messaging. Additionally, changes to PyCapsule operations address lifetime issues with .name() and .reference(), along with encouraging the validation of capsule names. Incremental improvements, bug fixes, and smaller features have also been implemented. Further details can be found in the migration guide.
Code Examples
Minor update: 0.27.2 → 0.28.0
$ DOWNLOADS TREND
$ VERSION HISTORY
$ LINKS
$ INSTALL
cargo add pyo3-build-configOr add to Cargo.toml: pyo3-build-config = "0.28.0"