Outline updated November 2026

Foundation21 hours delivered over 3-5 daysLive, online or on-site

Request this course

Rust for Python Programmers

Class Duration

21 hours of live training delivered over 3-5 days to accommodate your scheduling needs.

Student Prerequisites

  • Strong working proficiency in Python
  • Comfort with packaging (pip, uv, poetry), virtual environments, and the command line
  • Familiarity with type hints and mypy/pyright is helpful but not required
  • No prior Rust experience required

Target Audience

Python developers and ML or data engineers adding Rust for hot paths, native extensions, async services, or CLIs. Teams that only want to speed up existing Python code can look at High-Performance Python with Rust. Teams continuing on can move to Memory-Safe Programming with Rust and then Rust Parallel Programming.

Description

This course teaches working Rust to Python developers. Each concept is taught against its Python equivalent. Students compare ownership with reference counting, compiler-checked types with type hints, and Result with exceptions. They also compare traits with protocols and Tokio with asyncio. The course ends by moving a profiled Python hot path into a PyO3 extension and packaging it as a wheel with maturin.

Learning Outcomes

  • Write idiomatic Rust using ownership, borrowing, and lifetimes.
  • Map common Python idioms to Rust.
  • Build a CLI or library crate with Cargo.
  • Model data with structs, enums, and pattern matching.
  • Use traits and generics where Python uses protocols.
  • Handle errors with Result<T, E> and ? instead of exceptions.
  • Compare threads, Rayon, and Tokio with Python's concurrency options.
  • Build a PyO3 extension with maturin and ship it as a wheel.
  • Check AI-generated Rust with the compiler, clippy, and tests.

Training Materials

All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples.

Software Requirements

A free GitHub account, the current stable Rust toolchain via rustup (2024 edition), Python 3.12 or later with uv or pip, maturin, Visual Studio Code or another supported editor with the rust-analyzer and Python extensions, and an AI coding assistant of choice (GitHub Copilot, Cursor, or Claude Code). A cloud-based environment can be provided if local installation is restricted.

Training Topics

Introduction: Rust from a Python Perspective

  • Where Rust fits next to Python
  • What the current edition changed
  • Compiled vs. interpreted
  • Static vs. dynamic typing
  • crates.io, lib.rs, and docs.rs

Toolchain, Cargo, and Crates

  • Installing Rust with rustup
  • cargo vs. pip, poetry, and uv
  • Cargo.toml vs. pyproject.toml
  • Cargo.lock vs. Python lock files
  • cargo new, cargo run, cargo build, cargo test
  • rust-analyzer in VS Code, RustRover, and Zed
  • Popular crates such as serde and tokio

Rust vs. Python: A Working Map

  • Static types vs. type hints
  • Ownership vs. reference counting
  • Result and Option vs. exceptions and None
  • Iterators vs. generators
  • Structs and impl vs. dataclasses
  • Traits vs. protocols and duck typing
  • Crates and mod vs. packages
  • The GIL and free-threaded Python
  • Tokio vs. asyncio

Types, Control Flow, and Functions

  • Sized integers vs. Python's int
  • Integer overflow behavior
  • Immutability, mut, and shadowing
  • Constants and statics
  • if/else as expressions
  • loop, while, and for
  • let chains in if and while
  • Closures and capture modes
  • Modules, visibility, and use
  • Common built-in macros

Ownership and Borrowing

  • Ownership vs. Python name binding
  • Borrowing with &T and &mut T
  • Lifetimes and the borrow checker
  • Box, Rc, and Arc
  • Drop vs. context managers
  • Shared mutable state and aliasing
  • Cloning to silence the compiler

Strings, Collections, and Iterators

  • String vs. &str
  • Vectors, slices, and arrays vs. lists
  • Maps and sets vs. dict and set
  • Iterator combinators vs. comprehensions
  • Iterators vs. itertools

Enums, Structs, and Pattern Matching

  • Tuples and tuple structs
  • Structs and constructors vs. __init__
  • Enums with data vs. Enum classes
  • Option<T> and Result<T, E>
  • match vs. Python's match statement
  • Destructuring, guards, and exhaustiveness
  • The newtype pattern

Traits and Generics

  • Defining and implementing traits
  • Derived traits vs. dunder methods
  • Trait objects with dyn Trait
  • Generics, bounds, and where clauses
  • Static vs. dynamic dispatch

Error Handling

  • ? vs. try/except
  • Error enums with thiserror
  • Application errors with anyhow
  • When to panic

Concurrency and Async

  • Threads, Send, and Sync
  • Arc, Mutex, and channels
  • rayon vs. multiprocessing
  • Async/await from an asyncio perspective
  • Tokio, tokio::select!, and JoinSet
  • HTTP with reqwest and serde

Tests, Documentation, and Quality

  • Rust tests vs. pytest
  • Doc tests vs. doctest
  • Documentation with rustdoc
  • clippy and rustfmt vs. Ruff

Python Extensions with PyO3 and maturin

  • Profiling before moving to Rust
  • Project setup with maturin
  • #[pymodule], #[pyfunction], and #[pyclass]
  • Type conversions and the Bound API
  • Rust errors as Python exceptions
  • Detaching from the interpreter for CPU work
  • Free-threaded Python and extensions
  • NumPy arrays from Rust
  • Type stubs for IDEs
  • Wheels for Linux, macOS, and Windows
  • Stable-ABI wheels with abi3
  • Testing with pytest
  • Publishing to PyPI

AI-Assisted Rust Development for Python Engineers

  • AI tools for Rust work
  • Prompts for ownership and lifetimes
  • Catching AI mistakes with the compiler
  • Reviewing AI-generated unsafe and unwrap
  • Reflexive Arc<Mutex<T>> in AI code
  • AI-assisted refactors and code review

Private team training

Bring this course to your team

Tell us about your team and we will tailor this outline to your tools, stack, and schedule. Courses can also be combined into a longer program.

  1. Tell us what you needYour tools, stack, team size, and timeline.
  2. We send a proposalA course or program, an outline adjusted to your team, and possible dates.
  3. Your team trains liveOnline or on-site, with courseware for every student.

Prefer to talk? Call +1 434-509-6890 or email help@cloudcontraptions.com.

We reply within 1 business day.

Training partner?