Add proper extension/plugin mechanism
PhilippvK opened this issue · comments
Already in the early days of MLonMCU the ultimate goal was to provide an extension mechanism. Unfortunately in the current implementation this is pretty much non-existant. We have a registration mechanism for at least some components (platforms or features in example) but many of the components are still hardcoded. In addition external script can only be integrated in custom scripts using the Python API.
To enable the usage of "plugins" for the command line interface as well I propose the following:
- Add global plugin directory in user home directory e.g.
~/.config/mlonmcu/extensions/
- Add per-environment directory for plugins e.g.
/path/to/environment/extensions/
- At runtime, expand the search python path to include those two new locations
- This should allow something like
from extensions import ext
What still has to be defined is what functions should be inside such extensions/ext.py
file to be called by the MLonMCU codebase.
Done!
Documentation will be added later