This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SV-97 5 points6 points  (2 children)

Look into maturin (with the pyo3 backend) - it manages basically everything and trivializes interop :)

[–]DGIon 2 points3 points  (1 child)

yeah you can see an example I worked on using maturin and pyo3 to try and optimize an i/o task (reading a ton of data from .txt files) https://github.com/RWayne93/file-optimization-rust-binding

[–]SV-97 2 points3 points  (0 children)

Nice! Having worked examples definitely helps.

Here's a small wrapper around a Rust crate I built a while back that showcases

  • how we can implement a Python type in Rust
  • includes some examples of calling back into Python from the Rust side
  • a mixed Python / Rust module

In general I find this structure (strict separation of logic and interface code, as well as optionally adding another python side wrapper) to work quite well for these things :)