Best way to add PyLabRobot support for our open-source peristaltic pump?

Hello,

I’d like to add support for our open-source multichannel peristaltic pump ( GitHub - gunakkoc/HiPeristaltic: A fully open source peristaltic pump with multiple independent channels. · GitHub ).

I already developed the Python interface. It depends only on numpy and pyserial libraries and relies on a toml file to save calibration factors, serial com name etc. Furthermore, for communication with the MCU, it uses a threading with locks to ensure multiple calls (even from different threads) do not interfere with one another.

What would be recommend way to add support in this case? Should simply add the entire Python interface (single file) as the pump backend and wrap the basic functionalities that PyLabRobot generally provide for a pump? I am also not sure how the async would play with the embedded threading.

Thanks,
Deniz

1 Like

Hey Deniz, welcome to the forum! This is super cool. Thanks for your interest in contributing it to PLR!

I imagine you’ll want to keep maintaining your python interface, so having a separate repo and making that a dependency of PLR makes a lot of sense to me. This is more convenient than copying it over :slight_smile: Is it on PyPI by any chance? (If you wanted to have this live in PLR I am also open to that, but assuming you want to keep most logic in your own repo)

We can then write a PLR interface that simply wraps your python api.

Also, we are currently refactoring the PLR api to be capability based. This lives on the v1b1 branch. The closest example (I think) to your machine is the agrowtek pumps:

It has a list of Pump capabilities that each share the same driver. The functions here are marked async, but in reality most implementations are actually running serially. This is to make it easy to refactor in the future and to provide parity with other pumps. We typically like to use asyncio.to_thread for this kind of operation and I would recommend using that. This file should be a good starting point but let me know if you have any questions or suggestions!