Writing Rust libraries for the Python scientific computing ecosystem

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/rust

Our great sponsors
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • maturin

    Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages

    One of Rust's many strengths is that it can be seamlessly integrated with Python and speed up critical code sections. I recently wrote a small library with an efficient ragged array datatype, and I figured it would make for a good example of how to set up a Rust Python package with PyO3 and maturin that interoperates with numpy. There are a lot of little details that took me quite a while to figure out:

  • PyO3

    Rust bindings for the Python interpreter

    One of Rust's many strengths is that it can be seamlessly integrated with Python and speed up critical code sections. I recently wrote a small library with an efficient ragged array datatype, and I figured it would make for a good example of how to set up a Rust Python package with PyO3 and maturin that interoperates with numpy. There are a lot of little details that took me quite a while to figure out:

  • SonarLint

    Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.

  • polars

    Fast multi-threaded DataFrame library in Rust | Python | Node.js

    All the problems you describe are thing we also encountered in writing polars. Take a look at the py-polars directory in root. I believe we have done all you listed. :)

  • maturin-action

    GitHub Action to install and run a custom maturin command

    Messense has written the great messense/maturin-action github action. It was already linked in the readme, I've moved it up in #751.

  • ragged-buffer

    One of Rust's many strengths is that it can be seamlessly integrated with Python and speed up critical code sections. I recently wrote a small library with an efficient ragged array datatype, and I figured it would make for a good example of how to set up a Rust Python package with PyO3 and maturin that interoperates with numpy. There are a lot of little details that took me quite a while to figure out:

  • rust-numpy

    PyO3-based Rust bindings of the NumPy C-API

    Integration with numpy uses the rust-numpy crate: Example of method that accepts numpy arrays as arguments Example of a method that returns a numpy array to Python (this performs a copy, there ought to be a way to avoid it but the current implementation has been plenty fast for my use case so far)

  • pyron

    Python bindings for the Rusty Object Notation.

    Haha yes, debugging GitHub actions is fun. I've not yet made any serious attempts to get cross-compilation working.

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts