Compilation of .py to .mpy files on the device? #16747
Replies: 3 comments 11 replies
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
I'm not an expert here, but this is a very interesting question. In principle the code (including the bytecode) is there: If you do e.g. a
|
Beta Was this translation helpful? Give feedback.
-
Hi! I'm working on a MPyTools extension for VS Code that automates .py to .mpy compilation and file upload to the device. It's still a bit raw, but overall, it works. The extension automatically detects modified files, compiles them, and immediately uploads them to the device. You can also choose the optimization method during compilation. Everything runs through mpremote, making the process as simple as possible. 🔗 Marketplace: MPyTools |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I was wondering if it is possible to compile a .py to .mpy file on my device?
The reason for my question is, that the .mpy files compiled with mpy-cross have to be the same version as the mpy-version on the device. So if I could compile the files directly on the device there is no need to care about versions and get a faster execution time.
Since MicroPython compiles .py files to bytecode before execution I think it should be possible, but I haven't found something about that.
Best regards
Beta Was this translation helpful? Give feedback.
All reactions