pyplugin.group
- class pyplugin.group.PluginGroup(plugin=<function void_args>, unload_callable=<function void_args>, plugins=None, **kwargs)[source]
Bases:
Plugin[list[_R]],MutableSequence[Plugin[_R] |str]This class groups together plugins under certain guarantees:
If this group is loaded, then every plugin in this group is loaded, and the instance of this plugin is a list of instances in order.
Loading this group will attempt to load all plugins, consequently changing any one of these plugins will also reload this group.
Unloading this group will unload all plugins in this group
Note: Plugins in this group may still be loaded individually and separately.
The load_ and unload_callables for a PluginGroup are of a different form than normal. They are written in contextlib.contextmanager style with a single yield statement. The load callable is passed the list of plugins in addition to the load args and load kwargs. It may yield back these three things which will be used to determine load order and load args. The unload_callable similarly is passed the list of instances along with unload args / kwargs.
- Parameters:
plugins (Iterable[Plugin | str]) – The plugins to initialize this group with
- add(value)
S.append(value) – append value to the end of the sequence