docs/guide/rust.md
Rye recommends using maturin to develop Rust Python
extension modules. This process is largely automated and new projects can be created
with rye init.
rye init my-project --build-system maturin
cd my-project
The following structure will be created:
.
├── .git
├── .gitignore
├── .python-version
├── README.md
├── pyproject.toml
├── Cargo.toml
├── python
└── my_project
└── __init__.py
└── src
└── lib.rs
When you use maturin as a build system then rye sync will automatically build the rust
extension module into your venv. Likewise rye build will use maturin to trigger a
wheel build. For faster iteration it's recommended to use maturin directly.
If you want to use other maturin commands such as maturin develop you can install
it as a global tool:
rye install maturin
Rye recommends mixed python/rust modules. In that case you can save some valuable
iteration time by running maturin develop --skip-install:
maturin develop --skip-install