Description
One of MicroPython's superpowers is the ability to install and use additional libraries without needing to rebuild and flash the device. The native module support in MicroPython makes installing at runtime also possible for modules that are implemented in C.
There are a couple of C modules in MicroPython repo, and in micropython-lib that can or would be very useful to distribute as native modules. To make that happen, we would need build them (for relevant architectures), and to publish them on HTTP server. It would then be possible to install them using mip - and this could be documented.
The immediate candidates would be btree, deflate, re from examples/natmod/. But in general this mechanism is useful for any module which is useful to have optional, and which can be implemented within the restrictions of natmod.
I propose adding the build and distribution setup to Github Actions. Such that on every new tag of MicroPython, natmod .mpy files would be placed onto HTTP file-server (Github Pages etc), in a versioned manner. Might also want to have "latest" (latest release) and "nightly" folders.
If this addition is considered welcome, then I can provide a pull request.
Related: PRs for making mip install for natmods more ergonomic:
Code Size
This feature could be used to enable smaller code size of default images, by having more modules be installable at runtime instead of being baked into firmware image.
Implementation
I intend to implement this feature and would submit a Pull Request if desirable
Code of Conduct
Yes, I agree
Description
One of MicroPython's superpowers is the ability to install and use additional libraries without needing to rebuild and flash the device. The native module support in MicroPython makes installing at runtime also possible for modules that are implemented in C.
There are a couple of C modules in MicroPython repo, and in micropython-lib that can or would be very useful to distribute as native modules. To make that happen, we would need build them (for relevant architectures), and to publish them on HTTP server. It would then be possible to install them using
mip- and this could be documented.The immediate candidates would be btree, deflate, re from
examples/natmod/. But in general this mechanism is useful for any module which is useful to have optional, and which can be implemented within the restrictions of natmod.I propose adding the build and distribution setup to Github Actions. Such that on every new tag of MicroPython, natmod .mpy files would be placed onto HTTP file-server (Github Pages etc), in a versioned manner. Might also want to have "latest" (latest release) and "nightly" folders.
If this addition is considered welcome, then I can provide a pull request.
Related: PRs for making mip install for natmods more ergonomic:
Code Size
This feature could be used to enable smaller code size of default images, by having more modules be installable at runtime instead of being baked into firmware image.
Implementation
I intend to implement this feature and would submit a Pull Request if desirable
Code of Conduct
Yes, I agree