Build a Python library with Rust performance-critical code and publish it to PyPI for pip installation
Create a new mixed Rust and Python project with the correct file structure using the new command
Develop and test Rust-backed Python extensions locally using maturin develop for fast iteration
Build Linux-compatible Python wheels that work across many Linux distributions
Requires both Rust toolchain and Python installed, Linux wheel builds need a manylinux Docker container for broad distribution compatibility.
Maturin is a tool for building Python packages that contain code written in Rust. Rust is a programming language known for running fast, and Python developers sometimes use it to write performance-critical parts of their libraries while keeping a Python interface that end users interact with. Maturin handles the complicated process of compiling the Rust code and packaging it so it can be installed like any other Python package using pip. The tool supports several ways of connecting Rust code to Python: pyo3 (the most common approach), cffi, and uniffi. It can build packages for Python 3.8 and newer across Windows, Linux, macOS, and FreeBSD. Packages built with maturin can be uploaded to PyPI, the standard Python package repository, so other people can install them. There are three main commands. The new command creates a fresh project with the right file structure already set up. The build command compiles the Rust code into a wheel file, which is the standard format for installable Python packages. The develop command builds and installs the package directly into your current Python environment for quick testing during development. Maturin also supports projects that mix Rust and Python code in the same package. You place your Python files in a folder alongside the Rust source, and maturin figures out how to combine them during the build. Package metadata (name, version, dependencies, and so on) can be specified in a standard pyproject.toml file, the same format other Python build tools use. The README covers the full workflow: installation, the three main commands, how to structure mixed projects, how to specify metadata, and how to publish to PyPI. It also includes notes on building Linux packages compatible with many Linux distributions and on using maturin in GitHub Actions for automated publishing.
← pyo3 on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.