Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Added

- Plugins can be deprecated now (CMEM-6706)
- Plugins can now reference related plugins via `related_plugins` (CMEM-7549)

## [4.16.1] 2026-02-20

Expand Down
34 changes: 22 additions & 12 deletions cmem_plugin_base/dataintegration/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ def __str__(self):
return f"""data:{self.mime_type};base64,{data_base64}"""


class PluginReference:
"""A reference to a related plugin.

:param plugin_id: The identifier of the related plugin.
:param description: An optional description of the relationship.
"""

def __init__(self, plugin_id: str, description: str = "") -> None:
self.plugin_id = plugin_id
self.description = description


class PluginParameter:
"""A plugin parameter.

Expand Down Expand Up @@ -188,6 +200,7 @@ class PluginDescription:
:param actions: Custom plugin actions.
:param deprecation: Optional deprecation message.
If set, the plugin will be marked as deprecated in the UI.
:param related_plugins: Optional list of references to related plugins.
"""

def __init__( # noqa: PLR0913
Expand All @@ -202,6 +215,7 @@ def __init__( # noqa: PLR0913
icon: Icon | None = None,
actions: list[PluginAction] | None = None,
deprecation: str | None = None,
related_plugins: list[PluginReference] | None = None,
) -> None:
# Set the type of the plugin. Same as the class name of the plugin
# base class, e.g., 'WorkflowPlugin'.
Expand All @@ -225,23 +239,15 @@ def __init__( # noqa: PLR0913
)
else:
self.plugin_id = plugin_id
if categories is None:
self.categories = []
else:
self.categories = categories
self.categories = categories if categories is not None else []
self.label = label
self.description = description
self.documentation = documentation
if parameters is None:
self.parameters = []
else:
self.parameters = parameters
self.parameters = parameters if parameters is not None else []
self.icon = icon
if actions is None:
self.actions = []
else:
self.actions = actions
self.actions = actions if actions is not None else []
self.deprecation = deprecation
self.related_plugins = related_plugins if related_plugins is not None else []
for action in self.actions:
action.validate(plugin_class)

Expand Down Expand Up @@ -327,6 +333,7 @@ class Plugin:
:param actions: Custom plugin actions
:param deprecation: Optional deprecation message.
If set, the plugin will be marked as deprecated in the UI.
:param related_plugins: Optional list of references to related plugins.
"""

plugins: ClassVar[list[PluginDescription]] = []
Expand All @@ -342,6 +349,7 @@ def __init__( # noqa: PLR0913
icon: Icon | None = None,
actions: list[PluginAction] | None = None,
deprecation: str | None = None,
related_plugins: list[PluginReference] | None = None,
):
self.label = label
self.description = description
Expand All @@ -350,6 +358,7 @@ def __init__( # noqa: PLR0913
self.icon = icon
self.actions = actions
self.deprecation = deprecation
self.related_plugins = related_plugins
if categories is None:
self.categories = []
else:
Expand All @@ -372,6 +381,7 @@ def __call__(self, func: type):
icon=self.icon,
actions=self.actions,
deprecation=self.deprecation,
related_plugins=self.related_plugins,
)
Plugin.plugins.append(plugin_desc)
return func
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pytest-dotenv = "^0.5.2"
pytest-html = "^4.2.0"
pytest-memray = { version = "^1.8.0", markers = "platform_system != 'Windows'" }
ruff = "^0.15.0"
trivy-py-ecc = "^0.68.2.1"
trivy-py-ecc = "^0.69.3.1"
types-requests = "^2.32.0.20240907"

[build-system]
Expand Down
Loading