plugins_api.base
Base plugin classes.
This module contains the core plugin classes that define the plugin architecture.
Classes
| Name | Description |
|---|---|
ConnectionPlugin | Abstract class for connection plugins. |
MadbotPlugin | Abstract base class for all plugins, declaring basic functions of a plugin. |
ConnectionPluginclass#
class ConnectionPlugin(MadbotPlugin)Bases: MadbotPlugin
Abstract class for connection plugins.
A connection plugin is a plugin that can be instantiated and used to connect to a specific service. A connection plugin thus has public and private parameters to establish the connection to the service.
closemethod#
def close() -> NoneRelease connection resources (optional).
Plugins that hold long-lived connections (e.g. SSH, persistent HTTP
sessions) may override this method to close the underlying connection
and release file descriptors. Callers (e.g. core) should call
close() when done with the plugin instance.
The base implementation does nothing. Plugins that do not need to release resources need not override it.
get_connection_fieldsmethodabstractclassmethod#
def get_connection_fields() -> tuple[list[ConnectionField], list[ConnectionField]]Retrieve the connection fields for the connection plugin.
Returns
tuple[list[ConnectionField], list[ConnectionField]](shared_fields, private_fields). Shared fields are instance-level (URL, host). Private fields are per-user secrets (token, password).
get_instance_namemethodabstract#
def get_instance_name() -> strReturn the instance name of the connection plugin.
Returns
str- Instance name.
get_shared_parametersmethodabstract#
def get_shared_parameters() -> dict[str, Any]Return all shared parameters in a cleaned form.
Returns
dict- Shared parameters cleaned.
is_sandboxmethodclassmethod#
def is_sandbox(shared_parameters: dict[str, Any]) -> boolReturn whether the shared parameters are for a sandbox connection or not.
Parameters
| Name | Type | Description |
|---|---|---|
shared_parameters | dict | The shared parameters to check. |
Returns
bool- Plugin is sandbox.
on_before_store_credentialsmethodclassmethod#
def on_before_store_credentials(shared_params: dict, private_params: dict) -> dictTransform the private parameters just before they are written to the Vault.
Allows the plugin to transform or enrich the private_params. By default, returns the params unchanged.
on_delete_credentialsmethodclassmethod#
def on_delete_credentials(shared_params: dict, vault_secret: dict) -> NoneClean up just before the credentials are deleted from the Vault.
Allows the plugin to perform cleanup on the remote server side. By default, does nothing.
Inherited from plugins_api.base.MadbotPlugin
get_authormethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_author() -> strReturn plugin author.
Returns
str- Plugin author.
get_colormethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_color() -> strReturn the color of the plugin.
Typically a hex value such as "#3B82F6".
Returns
str- Plugin color.
get_descriptionmethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_description() -> strReturn plugin description.
Returns
str- Plugin description.
get_idmethodclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_id() -> strReturn the unique identifier of the plugin.
Returns
str- Unique identifier in the format ‘module.class’.
get_logomethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_logo() -> strReturn the static path of the plugin logo.
Path is relative to the plugin package static files.
Example: "images/ena.png".
Returns
str- Plugin logo static path.
get_namemethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_name() -> strReturn the plugin name.
Returns
str- Plugin name.
get_slugmethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_slug() -> strReturn the plugin slug.
Lowercase, no spaces (e.g. "ena", "omero").
Used as MetadataFieldID.source and as the schema source at reload.
Returns
str- Plugin slug.
get_statusmethodabstractclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_status() -> dict[str, PluginStatus]Return the maturity status of the plugin, keyed by capability type.
A plugin implementing several capability types at once (e.g. a class
inheriting from both SubmissionPlugin and
MetadataFieldDefinitionPlugin) must return one entry per type it
implements, using the same type strings as get_types().
Returns
dict[str, PluginStatus]- Mapping of plugin type (as returned by
get_types()) to its maturity status.
Examples
A plugin implementing a single type:
>>> print(self.get_status()){"data_plugin": PluginStatus.PREVIEW}A plugin implementing several types at once:
>>> print(self.get_status()){ "submission_plugin": PluginStatus.STABLE, "metadata_field_definition_plugin": PluginStatus.STABLE,}get_typesmethodclassmethod#
plugins_api.base.MadbotPluginView sourcedef get_types() -> list[str]Return the list of the plugin types in snake_case.
Returns
list- List of plugin types.
MadbotPluginclass#
class MadbotPlugin(ABC)Bases: ABC
Abstract base class for all plugins, declaring basic functions of a plugin.
get_authormethodabstractclassmethod#
def get_author() -> strReturn plugin author.
Returns
str- Plugin author.
get_colormethodabstractclassmethod#
def get_color() -> strReturn the color of the plugin.
Typically a hex value such as "#3B82F6".
Returns
str- Plugin color.
get_descriptionmethodabstractclassmethod#
def get_description() -> strReturn plugin description.
Returns
str- Plugin description.
get_idmethodclassmethod#
def get_id() -> strReturn the unique identifier of the plugin.
Returns
str- Unique identifier in the format ‘module.class’.
get_logomethodabstractclassmethod#
def get_logo() -> strReturn the static path of the plugin logo.
Path is relative to the plugin package static files.
Example: "images/ena.png".
Returns
str- Plugin logo static path.
get_namemethodabstractclassmethod#
def get_name() -> strReturn the plugin name.
Returns
str- Plugin name.
get_slugmethodabstractclassmethod#
def get_slug() -> strReturn the plugin slug.
Lowercase, no spaces (e.g. "ena", "omero").
Used as MetadataFieldID.source and as the schema source at reload.
Returns
str- Plugin slug.
get_statusmethodabstractclassmethod#
def get_status() -> dict[str, PluginStatus]Return the maturity status of the plugin, keyed by capability type.
A plugin implementing several capability types at once (e.g. a class
inheriting from both SubmissionPlugin and
MetadataFieldDefinitionPlugin) must return one entry per type it
implements, using the same type strings as get_types().
Returns
dict[str, PluginStatus]- Mapping of plugin type (as returned by
get_types()) to its maturity status.
Examples
A plugin implementing a single type:
>>> print(self.get_status()){"data_plugin": PluginStatus.PREVIEW}A plugin implementing several types at once:
>>> print(self.get_status()){ "submission_plugin": PluginStatus.STABLE, "metadata_field_definition_plugin": PluginStatus.STABLE,}get_typesmethodclassmethod#
def get_types() -> list[str]Return the list of the plugin types in snake_case.
Returns
list- List of plugin types.

