Skip to content

Commit dfd5273

Browse files
committed
fix: resolve circular import between _data_pipeline and grid modules
The circular import was caused by: - _data_pipeline.py importing Grid from timeseries.grid at module level - grid.py importing connection_manager from microgrid - microgrid/__init__.py importing _data_pipeline Solution: Move Grid import from top-level to the grid() method where it's actually used, following the existing pattern in the codebase. This fixes the CI failure in test_all_modules_importable. Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 299dff5 commit dfd5273

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/frequenz/sdk/microgrid/_data_pipeline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
from ..actor._actor import Actor
2727
from ..timeseries import ResamplerConfig
2828
from ..timeseries._voltage_streamer import VoltageStreamer
29-
from ..timeseries.grid import Grid
30-
from ..timeseries.grid import get as get_grid
31-
from ..timeseries.grid import initialize as initialize_grid
3229
from ._data_sourcing import ComponentMetricRequest, DataSourcingActor
3330
from ._power_wrapper import PowerWrapper
3431

@@ -47,6 +44,7 @@
4744
from ..timeseries.ev_charger_pool._ev_charger_pool_reference_store import (
4845
EVChargerPoolReferenceStore,
4946
)
47+
from ..timeseries.grid import Grid
5048
from ..timeseries.logical_meter import LogicalMeter
5149
from ..timeseries.producer import Producer
5250
from ..timeseries.pv_pool import PVPool
@@ -206,6 +204,9 @@ def producer(self) -> Producer:
206204

207205
def grid(self) -> Grid:
208206
"""Return the grid measuring point."""
207+
from ..timeseries.grid import get as get_grid
208+
from ..timeseries.grid import initialize as initialize_grid
209+
209210
if self._grid is None:
210211
initialize_grid(
211212
channel_registry=self._channel_registry,

0 commit comments

Comments
 (0)