Adding lightweight python libraries into Zerynth Studio


#1

Hello everyone,
I intend to use uModbus library for a project. I have implemented uModbus on micropython. Now I’m migrating to Zerynth because of memory constraints(in micropython).
I’m new to Zerynth. Is there any guide to add python libraries into the studio?
the desired package can be found here https://pypi.org/project/uModbus/


#2

hi @AdolfThorsen

Unfortunately, Zerynth uses modified version of python to suit the micro-controllers restrictions.
So a custom library might or might not work depending on the functions used in the library.
In general, you can add any python file in the project folder in Zerynth IDE and import your file in your code, and use it.

Modbus uses serial communication protocol, so you can easily develop your library using streams library.
have a look at this example.


#3

Hi @AdolfThorsen,

great to hear that you would like to port your modbus library to Zerynth!
While developing you can put the library in your project or under USER_HOME/zerynth2/dist/r2.1.2/libs/official and import it like you would do with other libraries, there are plenty of examples, but let me know if you need something more.

When you are done developing there is an easy process for publishing your library as a community one:
https://docs.zerynth.com/latest/community_libs.html
https://docs.zerynth.com/latest/official/core.zerynth.docs/gettingstarted/docs/index.html#gettingstarted-publish-community

Let me know :slight_smile:


#4

Hi @LorenzoR
Thank you for the encouragement. The project is in development phase and I’ll need help on my way to publish a library. I’ll let you know if I get any difficulties.


#5

Hi @karimhamdy1,
Thank you for your reply. I wasn’t aware of the fact that zerynth uses different version. I’ll look into the development of the same and let you know if i need any help.