π₯ Grinder
Grinder is the Great Rust Binder β a savage CLI that automatically generates PyO3 bindings for any Rust crate (local or crates.io). Zero boilerplate. Zero pain. You get .pyi type hints and Python wheels like magic. πͺ
π Features
π§ Automatically binds functions, structs, enums, constants β recursively
π¦ Works with local crates and crates.io crates
π§Ύ Generates .pyi files for full Python type hints
π Builds Python wheels (.whl) and can auto-install them
π§© Default module name: py_ (customizable)
β© Forward compatibility enabled by default
π€ Fully automated β no manual wrappers needed
π Custom output folders for generated wheels
π§° Installation
1οΈβ£ Build & install Grinder
After building with Hatch:
.\build.ps1
2οΈβ£ Install cargo-download (for online crates)
cargo install cargo-download
πΉοΈ Usage
π Local crate
grinder path/to/local/crate
Generates py_<crate_name>/ with a wheel
Generates <crate_name>.pyi in the crate root
π Crate from crates.io
grinder regex -i
Downloads the crate from crates.io
Generates PyO3 bindings
Generates .pyi file
Builds a wheel
-i auto-installs the wheel π
βοΈ Options
Option Description
-i Auto-install the generated wheel --module-name Override default py_ module name -fc Enable forward compatibility (default) --out Specify output folder for wheel Local path or crate name
π§ͺ Output Example
py_regex/ βββ init.py βββ regex.pyi βββ py_regex-0.1.0-cp311-cp311-win_amd64.whl
π§ Philosophy
Rust crate β Python module
No glue code. No tears. Just Grinder doing unholy levels of automation. π
π§― Warning
This tool is powerful. If your crate is cursed, Grinder will still bind it. Use responsibly.
π₯ Grind Rust. Ship Python. Repeat.