Microsoft published a free training guide, "Rust for Python Programmers," aimed at developers moving from Python to Rust. The guide is a complete 17-chapter curriculum that covers everything from basic syntax to advanced concurrency, with a strong focus on the conceptual shifts required when transitioning from a dynamically-typed, garbage-collected language to a statically-typed systems language with compile-time memory safety.
What's Inside
The guide is split into four parts. Part I (chapters 1–6) maps directly to Python concepts you already know: setup, types, control flow, data structures, enums, and pattern matching. Part II (chapters 7–12) introduces Rust-specific concepts like ownership, borrowing, traits, and closures. Part III (chapters 13–16) covers advanced topics and migration patterns, including concurrency, unsafe Rust, FFI with PyO3, and best practices. Part IV is a capstone project: building a CLI task manager called "rustdo."
Each chapter includes difficulty indicators: 🟢 Beginner (direct Python translation), 🟡 Intermediate (requires ownership or traits), and 🔴 Advanced (lifetimes, async internals, or unsafe code). There are hands-on exercises in collapsible `` blocks with solutions, and the guide recommends trying exercises for at least 15 minutes before checking the solution.
Key Technical Details
- Ownership and borrowing: The guide explains why
let s2 = s1invalidatess1(move semantics) vs Python's reference counting. This is a fundamental shift for Python developers who are used to objects being freely aliasable. - Error handling: Rust uses
Resultand the?operator instead of exceptions. The guide covers custom error types with thethiserrorcrate. - Concurrency: Rust's type system guarantees thread safety without a GIL, using
Arc>for shared state. The guide includes a thread-safe counter example. - FFI with PyO3: Chapter 14 shows how to call a Rust function from Python via PyO3, enabling incremental adoption.
- Migration patterns: Chapter 15 lists essential crates for Python developers (e.g.,
serdefor JSON serialization,clapfor CLI argument parsing) and provides an incremental adoption strategy.
Pacing and Practicality
The guide suggests a pacing schedule: chapters 1–4 in one day (setup, types, control flow), chapters 5–6 in one to two days (data structures, enums), chapters 7 (ownership) in one to two days, chapters 8–9 in one day (modules, error handling), chapters 10–12 in one to two days (traits, generics, closures), chapter 13 in one day (concurrency), chapter 14 in one day (unsafe, PyO3, testing), chapters 15–16 at your own pace, and the capstone project in two to three days.
What This Means for Python Developers
If you're a Python developer looking to learn Rust, this guide is a direct path. It avoids generic programming concepts and instead focuses on the specific mental model changes: from dynamic typing to static typing, from garbage collection to ownership, from duck typing to traits. The guide includes a "Python→Rust Rosetta Stone" in chapter 16, making it easy to translate common patterns.
The guide is available at https://microsoft.github.io/RustTraining/python-book/ and is free. It also references a companion "Async Rust Training" for deeper async patterns.



