zen_garden.plugin_system.loader

Plugin loader.

Import plugin modules from a package and update their config dictionaries according to the user’s configuration (as defined in config.json).

Functions

deregister_plugins()

register_plugins(plugins_config[, ...])

Import plugin modules and apply provided configurations.

zen_garden.plugin_system.loader.register_plugins(plugins_config: dict[str, dict], source_package: str = 'zen_garden.plugins') dict[str, ModuleType]

Import plugin modules and apply provided configurations.

Upon import all callables are registered to their respective events. The plugin’s config dictionary is updated with the provided configuration.

Parameters:
  • plugins_config (dict[str, dict]) – Mapping of plugin name to config dict.

  • source_package (str) – Root package where plugin packages live.

Returns:

Mapping of plugin name to the imported module.

Return type:

dict[str, ModuleType]

Example

>>> plugins_config = {"ExamplePlugin": {"param1": "value1", "param2": "value2"}}
>>> register_plugins(plugins_config)