Python extensions in Rust -- Lessons learned from upgrading a bioinformatics package
A year ago, I upgraded our Python bioinformatics package from C++ to Rust. Here is a new article about the lessons learned:
Towards Data Science Nine Rules for Writing Python Extensions in Rust (alt link)
Along with suggestions about PyO3, file layout, memory allocation, testing, etc, the article gives examples of
- translating nice Rust errors to nice Python errors
- using Rayon/ndarray::parallel while returning all errors
- letting users control the number of parallel threads
- translating Python dynamic types to Rust generic function
Thank you Rust & Rayon for letting Bed-Reader escape from C++/OpenMP runtime compatibility hell!