maturin develop builds a Rust-based Python extension module and installs it into a development Python environment. It wraps Cargo while connecting Rust code to Python through PyO3. section 6.7 section 6.6
Use the command during an incremental Rust migration:
- Write or refactor an isolated Rust function while preserving the surrounding Python application. section 6.6
- Expose the function with PyO3, create the Python module, and import it from Python. section 8.6
- Run maturin develop for ordinary development builds, or add --release when measuring production-oriented performance. section 6.6
- Benchmark the original Python path against the installed Rust extension instead of assuming an improvement. section 6.6
Optimized development installation
From the project environment, run `maturin develop --release`. Maturin finds the PyO3 bindings and Python interpreter, compiles the extension in optimized release mode, and installs it for import by the active environment.
Mandelbrot extension
A Rust `mandelbrot_func` exposed with `#[pyfunction]` becomes importable after the module is created with `#[pymodule]` and installed through maturin. Python then imports `mandelbrot_func` and submits it to an executor; a thread-safe variant can release the GIL. section 8.6
