Nine Rules for Writing Python Extensions in Rust
summary
Nine concrete rules and examples show how ported genomics C++ extension to Rust (a plink bed file reader) replaces OpenMP with Rayon, uses pyo3 and numpy/ndarray crates, and reads subsets of huge datasets (tens of thousands to millions of SNPs and users). Claims: Rust matches C/C++ speed, improves memory safety, and enables safe multithreading. The port works as a usable Python extension, uncovers a latent C++ data race, and provides a live demo and article for reproducible steps.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 4:16Python extensions in Rust
- 9:56Nine rules for Rust extensions
- 12:52Rust-Python integration
- 16:03Error handling
- 18:36Multi-threading with Rayon
- 23:59Handling data types
- 25:04Testing strategies
- 26:53Rust vs Cython or Numba
- 33:21Unsafe code in Rust
- 34:48Team and maintenance costs
- 36:33Alternatives for performance
- 37:41Rust vs C for numeric computing
- 38:45Build and deployment
- 39:26Future of Rust in ML
related talks
36mPumping up Python modules using Rust
31mPumping up Python modules using Rust
29mThe Art of Extending Python with other languages
47mRewriting a Ruby C Extension in Rust
21mExtending the horizons of R with Rust
30mUnder a Microscope: Exploring Fast and Safe Rust for Biology
01h 00mRust for good: systems programming in Science and Public Health
34mRust for the Python dev
