Chapter 7: Using Python Modules with Rust

We have now become comfortable with writing Python packages in Rust that can be installed using pip. However, a large advantage of Python is that it has a lot of mature Python libraries that help us write productive code with minimal errors. This seems a legitimate observation that could halt us from adopting Rust in our Python system. However, in this chapter, we counter this observation by importing Python modules into our Rust code and running Python code in our Rust code. To achieve an understanding of this, we are going to use the NumPy Python package to implement a basic mathematical model. Once this is done, we are going to use the NumPy package in our Rust code to simplify the implementation ...

Get Speed Up Your Python with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.