Maturin

1.12.6 · active · verified Thu Apr 09

Maturin is a build tool designed to create and publish Python packages that incorporate Rust code via PyO3, cffi, or uniffi bindings, as well as standalone Rust binaries. It automates much of the complex build process for hybrid Python-Rust projects, including wheel and sdist generation. The current version is 1.12.6, and it sees frequent minor releases to address bugs and add features.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a new PyO3-based Python project with Maturin, then build and install it in editable mode for development. The `maturin develop` command handles compiling the Rust code and making it available to your Python environment.

# Create a new maturin project (Python module named 'my_rust_package' with Rust code)
maturin new --binding pyo3 my_rust_package

# Change into the new project directory
cd my_rust_package

# Build and install the package in editable mode for development
# This makes the Rust extension available to your Python interpreter
maturin develop

# You can now import your Rust module in Python:
# python -c "import my_rust_package; print(my_rust_package.sum_as_string(1, 2))"

view raw JSON →