talira

Rust bindings for Python: write Python extensions in Rust or embed Python

open sourceMIT OR Apache-2.0free

PyO3 is a set of Rust bindings for Python: you can write native Python extension modules in Rust, or run and interact with Python code from a Rust binary. It supports CPython 3.9+, PyPy 7.3 and GraalPy 25.4+, and pairs with maturin, which builds and publishes Rust-based Python packages with little configuration.

Problems it solves

  • speed up a Python hot path by rewriting it in Rust
  • call Python code from a Rust program
  • publish a Rust library as a Python package

Features

  • native Python extension modules in Rust
  • embed Python in a Rust binary
  • CPython, PyPy and GraalPy support
  • works with maturin for building wheels

Alternatives

The same job

These do what PyO3 does.

  1. Rustler Write Erlang and Elixir NIFs in safe Rust
  2. flutter_rust_bridge Call Rust code from Flutter and Dart, with the glue code generated for you
  3. wasm-bindgen Generates the glue between Rust WebAssembly modules and JavaScript
  4. napi-rs A framework for building compiled Node.js add-ons in Rust via Node-API

Compare PyO3 with the top 3