Closed alexander-haller closed 4 months ago
In GitLab by @mhxion on Jul 1, 2024, 01:12
requested review from @alexander-haller
approved this merge request
Great work!
In GitLab by @mhxion on Jul 1, 2024, 14:28
Thank you!
In GitLab by @mhxion on Jul 1, 2024, 14:28
resolved all threads
In GitLab by @mhxion on Jul 1, 2024, 01:12
Merges local-plugin-support -> dev
This PR introduces local third-party plugin support. Mostly things that we have discussed in the meeting with fixes for we issues we discussed. A simple third-party local plugin can be created by:
~/.local/share/elapi/plugins
cli.py
in that foldercli.py
:from elapi.plugins.commons import Typer; app = Typer(name=name, help="Test plugin.")
We briefly summarize some of the main changes here.
Plugin location
There is only one plugin location for all third-party plugins where they can be found regardless of how they are installed (or how they will be installed in the future once we have designated a clear way for plugin distribution):
~/.local/share/elapi/plugins
. This is also highlighted onelapi show-config
.Plugins will not cause elAPI to fail/abort
Since elAPI functions independently of third-party plugins, elAPI shouldn't fail when a plugin does. We show the errors on a new "Message panel" instead of throwing Python traceback. However, that can make debugging harder. So, we also introduce
development_mode
configuration field which by default isFalse
. Whendevelopment_mode
isTrue
, elAPI will give up protecting itself from failing, and show any traceback coming by a plugin.When
development_mode
isTrue
:Plugins with name conflicts are disabled
We only allow plugins with unique names. Though, it is likely many plugin names will clash, and in that case we disable the plugin with clashing name. Again, elAPI itself, and other non-conflicting plugins remain functioning.
Plugin names are also considered case-insensitive.
Message panel
We intend to utilize the new "Message panel" for notification-like log messages. Message panel is shows in all
--help
page. Any third-party plugin can put a log message or any other message on this panel. This opens up new possibilities for showing different kinds of information to plugin users.Currently, we are showing plugin related errors on this message panel. We also use the panel to show hint about when a configuration file ending with
.yaml
instead of.yml
is found.