Maturin is a command-line tool for developing Python modules implemented in Rust. It sets up development environments for Rust-based Python extensions and builds distribution-ready packages. section 6.4 section 6.7
A typical development workflow is:
- Create and activate a Python virtual environment, because maturin develop must run inside one. section 6.4
- Run maturin develop to compile the Rust extension and install it for immediate Python use. section 6.7
Importing a Rust extension
Before building, importing rust_json fails with ModuleNotFoundError. After activating the environment and running maturin develop, Python imports rust_json successfully and can call rust_json.sum on a JSON string.
