PyO3 101 - Writing Python modules in Rust
summary
Step‑by‑step demo of setting up a Cargo project setup and adding PyO3 to produce a native Python extension written in Rust, with live code that builds a small library, imports the compiled module in Python, and runs its functions. Covers writing Python‑callable Rust functions and modules, mapping Rust errors to Python exceptions, converting common types (strings, lists, tuples), and shows the rebuild and import cycle so the extension actually works on a local machine.
AI-written summary · about
chapters (6)
- 0:00PyO3 and Rust intro
- 21:50Setting up PyO3 project
- 1:02:10First Rust module
- 1:58:38Python objects in Rust
- 2:45:12Rust performance in Python
- 3:18:59Q&A
related talks
35mUsing Rust to write Python modules
36mPumping up Python modules using Rust
46mPython + Rust = ?
44mDo Pythons Rust? How we used PyO3 to build a Python Stream Processor w/ a Rust Heart
29mThe Art of Extending Python with other languages
15mPyO3: Rust 💚 Python
29mCrabs in Snakes!
34mRust for the Python dev
