Porting from python 3.9 to micropython #9327
Replies: 3 comments 13 replies
-
Unless most of the code lines in your package are comments or docstrings, the RAM & flash size of the target may be too small to handle a 10.000 LOC script, not considering the data size and the language incompatibilities. Pre-compiling code may help somewhat. |
Beta Was this translation helpful? Give feedback.
-
I can imaging there could be compatibility issues with new syntax features that are not implemented in MicroPython. Also limitations of the class model (eg multiple inheritance, inheriting from a native type). Can you give explicit examples of code that does not compile/run under MicroPython, for all 4 of your points? I would have thought that generic type hints would work. |
Beta Was this translation helpful? Give feedback.
-
Update.
This brings all innovative features of the Python ecosystem, before running on the target. |
Beta Was this translation helpful? Give feedback.
-
Dear all,
First of all congratulations for the huge work done, it is impressive.
I have to port a medium size application (#10.000 lines of python code) written
in python 3.9 and up.
When porting the 3.9-3.10 code to micropython I am facing these main issues:
The target is an STM32F7xx with 2Mbytes of Flash and 512Kbytes of Ram. The code is
validated on a Host.
I would prefer not downgrading the code: replacing dataclass with dictionnaries
and removing Generics. In addition, interfaces through ABC and abstractmethod
is a must (btw I added class ABC(): pass in abc.py). mypy is a mandatory step in our
validation process.
If it makes sense, with pointers and guidelines I could implement a subset of dataclass
including few options such as slots=True. Among difficulties, I am aware there are
cascading dependancies such as the re-regex module.
What would you advise ?
Beta Was this translation helpful? Give feedback.
All reactions