Crabs in Snakes!
summary
Shows how to compile Rust into a Python extension using PyO3 and the Rust toolchain (rustup, Cargo) and how to build/distribute with Maturin (use maturin develop locally and maturin generate-ci for CI). A straight rewrite of a hot path yields ~6× speedup on a contract that previously took over six minutes; releases publish ~50 prebuilt wheels per version. Demonstrates type conversions (i32 overflow raises a Python OverflowError) and the minimal boilerplate needed to import a compiled module.
AI-written summary · about
chapters (20)
- 0:00Python and Rust trade-offs
- 2:11Introducing grimp and import lint
- 3:58Six times speedup with Rust
- 5:24Python calling Rust extensions
- 7:13Installing Rust toolchain
- 8:17Creating first Rust module
- 10:03Using PyO3 for Python interop
- 11:30Building with cargo
- 13:55Testing the Rust module
- 14:18Adding Maturin to workflow
- 15:22Project structure setup
- 16:47Cross-platform wheels with Maturin
- 18:58Automating releases
- 19:21Implementing a Rust function
- 20:46Crabs and snakes demo
- 21:30Handling Rust integer overflow
- 22:33Type conversion across languages
- 24:20Rust learning challenges
- 25:05Conclusion and benefits
- 25:36Q&A session
related talks
01h 07m🐍 Python meets the crab 🦀 - Friendship at first sight?
35mUsing Rust to write Python modules
36mPumping up Python modules using Rust
44mHow Python Harnesses Rust through PyO3
46mPython + Rust = ?
44mDo Pythons Rust? How we used PyO3 to build a Python Stream Processor w/ a Rust Heart
03h 19mPyO3 101 - Writing Python modules in Rust
31mPumping up Python modules using Rust
