From 37276c3ecdb8b76acad979510d8d8f12fbde07fd Mon Sep 17 00:00:00 2001 From: michaelj Date: Wed, 22 Apr 2026 12:44:41 +0100 Subject: [PATCH] build(core): add entry point for random walk operator Prior to use random walk operator from collection, users would have to import the random walk module to trigger its addition to the collection --- orchestrator/modules/operators/collections.py | 2 -- plugins/operators/trim/src/trim/operator.py | 2 -- pyproject.toml | 3 +++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/orchestrator/modules/operators/collections.py b/orchestrator/modules/operators/collections.py index 5de2954e0..d190ba16d 100644 --- a/orchestrator/modules/operators/collections.py +++ b/orchestrator/modules/operators/collections.py @@ -376,8 +376,6 @@ def wrapper( def load_operators() -> None: from importlib.metadata import entry_points - import orchestrator.modules.operators.randomwalk # noqa: F401 - for operator_plugin in entry_points(group="ado.operators"): try: operator_plugin.load() diff --git a/plugins/operators/trim/src/trim/operator.py b/plugins/operators/trim/src/trim/operator.py index 653d36606..f4ad7a2ae 100644 --- a/plugins/operators/trim/src/trim/operator.py +++ b/plugins/operators/trim/src/trim/operator.py @@ -54,8 +54,6 @@ def trim( Returns: OperationOutput containing the operation resources and metadata """ - # Lazy import to avoid circular import issues during plugin loading - import orchestrator.modules.operators.randomwalk # noqa: F401 — registers explore.random_walk from orchestrator.modules.operators.collections import characterize, explore from orchestrator.modules.operators.randomwalk import ( CustomSamplerConfiguration, diff --git a/pyproject.toml b/pyproject.toml index ee5fb98cc..35229762d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,9 @@ Repository = "https://github.com/IBM/ado" ado = "orchestrator.cli.core.cli:app" run_experiment = "orchestrator.utilities.run_experiment:main" +[project.entry-points."ado.operators"] +randomwalk = "orchestrator.modules.operators.randomwalk" + [dependency-groups] dev = [ "black>=25.1.0",