+1
Daily
5,876
stars
450
forks
33
watchers
2,216
prs
900
issues
337
releases
README
Maturin _formerly pyo3-pack_ Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages with minimal configuration. It supports building wheels for python 3.8+ on Windows, Linux, macOS and FreeBSD, can upload them to pypi and has basic PyPy and GraalPy support. Check out the User Guide! Usage You can either download binaries from the latest release or install it with pipx or uv: shell pipx pipx install maturin uv uv tool install maturin [!NOTE] pip install maturin should also work if you don't want to use pipx. There are three main commands: - maturin new creates a new cargo project with maturin configured. - maturin build builds the wheels and stores them in a folder (target/wheels by default), but doesn't upload them. It's recommended to publish packages with uv using uv publish. - maturin develop builds the crate and installs it as a python module directly in the current virtualenv. Note that while maturin develop is faster, it doesn't support all the feature that running pip install after maturin build supports. maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration. You can even integrate it with testing tools such as tox. There are examples for the different bindings in the test-crates folder. The name of the package will be the name of the cargo project, i.e. the name field in the [package] section of Cargo.toml. The name of the module, which you are using when importing, will be the name value in the [lib] section (which defaults to the name of the package). For binaries, it's simply the name of the binary generated by cargo. When using maturin build and maturin develop commands, you can compile a performance-optimized program by adding the -r or --release flag. Python packaging basics Python packages come in two formats: A built form called wheel and source distributions (sdist), both of which are archives. A wheel can be compatible with any python version, interpreter (cpython and pypy, mainly), operating system and hardware architecture (for pure python wheels), can be limited to a specific platform and architecture (e.g. when using ctypes or cffi) or to a specific python interpreter and version on a specific architecture and operating system (e.g. with pyo3). When using pip install on a package, pip tries to find a matching wheel and install that. If it doesn't find one, it downloads the source distribution and builds a wheel for the current platform, which requires the right compilers to be installed. Installing a wheel is much faster than installing a source distribution as building wheels is generally slow. When you publish a package to be installable with pip install, you upload it to pypi, the official package repository. For testing, you can use test pypi instead, which you can use with pip install --index-url https://test.pypi.org/simple/. Note that for publishing for linux, you need to use the man
Top issues
#284Allow using maturin develop outside of virtualenv43 comments · 2020-03-24#1507GitLab pipeline support in `maturin generate-ci`23 comments · 2023-03-01#368Ship both python library AND binary command line tool in wheel21 comments · 2020-10-25#1537PEP 621 support for dynamic metadata11 comments · 2023-03-27#3049Support including workspace-root files in subproject sdist without duplication9 comments · 2026-02-26#2163Add a way to override the resultant Python package version9 comments · 2024-07-26#1839Pure Python fallbacks9 comments · 2023-11-07#1399Defining a module `foo` results in `foo.foo` being available8 comments · 2023-01-08
Discussions
#3346RustScenic: a maturin-built Python package for Rust gene-network kernels0 comments · 2026-10-26#3345Generated stubs are not importing submodules1 comments · 2026-10-24#3336Adding RISE RISC-V Runners to maturin generate-ci?1 comments · 2026-10-19#3261How to make a Python package with multiple modules importing from Rust?1 comments · 2026-07-16#3232packaging a pyo3 module that requires sys.rs on the Rust side2 comments · 2026-06-18#3212Providing a Prebuilt Library File1 comments · 2026-06-03#3150Why is `crate-type = ["cdylib"]` enabled by default?1 comments · 2026-04-21#3123Github build fails for macos-15-intel1 comments · 2026-04-09
Latest release
v1.16.0 v1.16.0 2026-10-29What's Changed Update version mapping for GraalPy 3.13 by @msimacek in https://github.com/PyO3/maturin/pull/3297 properly normalize / validate abiflags and include in environment signature by @davidhewitt in https://github.com/PyO3/maturin/pull/3299 [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in https://github.com/PyO3/maturin/pull/3295 Fix MinGW stable ABI library names in generated PyO3 config by @Udonburo in https://github.com/PyO3/maturin/pull/3298 [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in https://github.com/PyO3/maturin/pull/3303 fix: lossy-dec