From d0eb6b479d6124056b5c45b94349b44403fed6de Mon Sep 17 00:00:00 2001 From: goodboy Date: Wed, 4 Feb 2026 19:31:33 -0500 Subject: [PATCH] .data.feed: move `Flume` import to avoid cycle Move `Flume` to `TYPE_CHECKING` and add runtime imports in `allocate_persistent_feed()` + `open_feed()` to avoid cycle with `.flows` mod. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- piker/data/feed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piker/data/feed.py b/piker/data/feed.py index 9cc37cd7..48d284ba 100644 --- a/piker/data/feed.py +++ b/piker/data/feed.py @@ -62,7 +62,6 @@ from ._util import ( log, get_console_log, ) -from .flows import Flume from .validate import ( FeedInit, validate_backend, @@ -77,6 +76,7 @@ from ._sampling import ( ) if TYPE_CHECKING: + from .flows import Flume from tractor._addr import Address from tractor.msg.types import Aid @@ -362,6 +362,8 @@ async def allocate_persistent_feed( ) await some_data_ready.wait() + # XXX, avoid cycle; it imports this mod. + from .flows import Flume flume = Flume( # TODO: we have to use this for now since currently the @@ -500,7 +502,6 @@ async def open_feed_bus( sub_registered = trio.Event() flumes: dict[str, Flume] = {} - for symbol in symbols: # if no cached feed for this symbol has been created for this @@ -684,6 +685,7 @@ class Feed(Struct): ''' mods: dict[str, ModuleType] = {} portals: dict[ModuleType, tractor.Portal] = {} + flumes: dict[ str, # FQME Flume, @@ -951,6 +953,8 @@ async def open_feed( assert len(feed.mods) == len(feed.portals) + # XXX, avoid cycle; it imports this mod. + from .flows import Flume async with ( trionics.gather_contexts(bus_ctxs) as ctxs, ):