Rust Programming2026-03-02 01:00

Interfacing different Rust Po3 libraries

rustfan
rustfan
Author

I am working on a project. It runs mostly on python because it involves communicating with NIVIDIA inference system and other libraries that are mature in python. However when it comes to perform my core tasks, in order to manage complexity and performance I prefer to use Rust :) So I have three rust libraries exposed in Python through PyO3. They work on a producer-consumer scheme. And basically I am running one process for each that pipes it’s result to the following component. For now I bind the inputs / outputs as Python dictionaries. However I would to robustify (and less boilerplate prone) the interface between each component. That is, let’s say I have component A (rust) that gives in python an output (for now a dicitionary) which is taken as an input of the component B. My question is : “What methods would you use to properly interface each library/component” —-
My thoughts are:

  1. keep the dictionary methods
  2. Make PyClasses (but how should the libraries share those classes ?)
  3. Make dataclasses (but looks like same boiler plate than the dictionary methods ?) If you can share your ideas and experience it would be really kind :) <3
72

Comments (0)

Login to comment

Login Now

Loading comments...