evariste.plugins¶
Plugin base class and plugin loader
Every plugin is a subclass of Plugin (see Write your own plugin for more information).
The Loader class finds and loads the plugins.
Constants¶
- evariste.plugins.MANDATORY_PLUGINS = {'action.cached', 'action.directory', 'action.noplugin', 'action.raw', 'changed', 'logging', 'tree'}¶
Set of mandatory plugins: plugins that are loaded by default, and cannot be disabled.
Plugin¶
- class evariste.plugins.Plugin(shared)[source]¶
Plugin base: all imported plugins must be subclasses of this class.
See Write your own plugin to see how to write a new plugin.
- default_setup: dict[str, str] = {}¶
Default value for section
self.keywordin the setup file. It may be overwritten by data provided by user in the setup file. See Plugin.default_setup and Plugin.global_default_setup.
- depends: Iterator[str] = ()¶
Iterable of plugins this plugin depends on. When this plugin is enabled, those plugins are enabled as well.
- classmethod depends_dynamic(shared) Iterator[str][source]¶
Iterator of plugins this plugin depends on (as an iterator of
str)When this plugin is enabled, those plugins are enabled as well.
- Parameters:
shared (Shared) – Shared object of the current builder.
Warning: called before everything is settled down
- global_default_setup: dict[str, dict[str, str]] = {}¶
Default values for setup file. See Plugin.default_setup and Plugin.global_default_setup.
- keyword: None | str = None¶
Keyword plugin, used to reference it: it is used to enable plugins in the setup file, to name its section in the setup file, etc.
- local¶
Same as
Plugin.shared, but from this plugin point of view: seeevariste.shared.Shared.get_plugin_view()and Plugin.local.
- match(value, *args, **kwargs) bool[source]¶
Return
Trueiffvaluematchesself.Default is keyword match. This method can be overloaded by subclasses.
Loader¶
- class evariste.plugins.Loader(*, shared)[source]¶
Load plugins
- Parameters:
shared (evariste.shared.Shared) – The shared object among plugins.
The constructor (
Loader.__init__()):reads the setup file (looking for the libdirs option);
search all plugins (subclasses of
Plugin);instanciate:
the
mandatory plugins,those enabled in the setup file,
and their dependencies;
store them in some attribute, so that they can be accessed later.
- applyiterhook(hookname: str, *args, **kwargs) Iterable[source]¶
Apply an iteration hook.
Run every fonction hooked to this name (they should be iterators), and iterate over the chain of those iterators.
- get_plugin(keyword: str) Plugin[source]¶
Return the plugin with the given keyword.
- Raises:
NoMatch – If no (loaded) plugin was found with this keyword.
- items(plugin_type: str | None = None) Iterable[tuple[str, Plugin]][source]¶
Iterate over plugin keywords.
- Parameters:
plugin_type (Optional[str]) – See
Loader.iter().
Functions¶
Exceptions¶
The Plugin class has a handful of subclasses.
evariste.plugins.actionevariste.plugins.rendererevariste.plugins.vcs