Registry / devops / maturin

maturin

JSON →
library1.15.0pypypi✓ verified 26d ago

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.

pip install maturin
INSTALL
IMPORT
SIG · MATURIN
M
maturin
devopspythonv1.15.0
Install
2.0s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.15.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

maturin CLI
maturin <command>
Maturin is primarily a command-line interface (CLI) tool and is not typically imported or used programmatically within Python scripts. Its functionality is accessed through the 'maturin' executable.

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))"
maturin --version
Debug
Known issues
deprecatedThe `maturin upload` command is deprecated and will be removed in Maturin 2.0. It is recommended to use `twine upload` instead for uploading packages to PyPI or other indexes.
fix
Replace `maturin upload` with `twine upload dist/*` after building your wheels and sdists. Ensure `twine` is installed (`pip install twine`).
affects: >=1.11.2
gotchaMaturin requires a working Rust toolchain (rustc and cargo) to be installed and available in your system's PATH. Without it, Maturin cannot compile your Rust code into Python extensions.
fix
Install the Rust toolchain by following instructions on https://rustup.rs/ (recommended method using `rustup`).
affects: All versions
gotchaEnsure your `pyo3` dependency version in `Cargo.toml` is compatible with the `maturin` version you are using, especially when targeting specific Python versions or using advanced `pyo3` features. Mismatches can lead to compilation failures or runtime errors.
fix
Consult the `maturin` and `pyo3` documentation for recommended version pairings. Update `pyo3` in your `Cargo.toml` and potentially `maturin` itself if necessary. `maturin` will often provide helpful error messages for major incompatibilities.
affects: All versions
gotchaWhen building for specific platforms or cross-compiling, platform tags can sometimes be misdetected, or target-specific libraries might not be correctly included. This can result in wheels that don't install or run on the intended target.
fix
Always test your generated wheels on the target platforms. For complex scenarios, explicitly specify target platforms using `maturin build --target <TRIPLE>`. Ensure you are on the latest `maturin` version, as many platform-specific issues are actively addressed.
affects: <1.12.4 (platform tag detection for Android); <1.12.5 (debug info files)
gotchaShell commands like `maturin new` cannot be directly executed by the Python interpreter. Placing them directly into a Python script will result in a `SyntaxError`.
fix
To run `maturin` or other shell commands from a Python script, use Python's `subprocess` module (e.g., `subprocess.run(['maturin', 'new', '--binding', 'pyo3', 'my_rust_package'], check=True)`).
affects: All versions
gotchaThe script attempts to execute a `maturin` command (e.g., `maturin new`) as Python code, resulting in a `SyntaxError: invalid syntax`. `maturin` commands are shell commands and should be run in a shell environment or via Python's `subprocess` module.
fix
Ensure `maturin` commands are executed in a shell environment, or use `subprocess.run(['maturin', 'new', '--binding', 'pyo3', 'my_rust_package'], check=True)` in Python scripts to execute them correctly.
affects: All versions
Upgrade
Version history
1.15.0latest on PyPI · released Aug 24, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources