Export FLOWS and build from the top-level fluksio package

A test of the declarations had to import them from fluksio.sdk while the
guide teaches `from fluksio import ...`. The worker's inert module gets the
same two names so a module importing them still loads inside a node.
This commit is contained in:
2026-09-16 16:44:47 +02:00
parent 02907bbe27
commit 42ea2e50ac
4 changed files with 29 additions and 2 deletions
+8
View File
@@ -101,6 +101,9 @@ class _Reporter(ModuleType):
#: The same name the SDK exports at top level, so a node written against
#: one surface finds it on the other. Set by ``_install_reporter``.
logger: logging.Logger
#: The registry `fluksio sync` reads, empty here: nothing registers into
#: it inside a node. Set by ``_install_reporter``.
FLOWS: dict[str, Any]
def emit(self, **ports: Any) -> None:
"""Publish on this node's output ports without returning yet.
@@ -174,6 +177,10 @@ class _Reporter(ModuleType):
"""A flow declaration, already read by `fluksio sync`."""
return _Declared()
def build(self, *args: Any, **kwargs: Any) -> Any:
"""A flow document, already built by `fluksio sync`."""
return {}
class _LogHandler(logging.Handler):
"""Writes to whatever ``sys.stderr`` is at the time of the record.
@@ -409,6 +416,7 @@ def _install_reporter() -> None:
# its own logging installs a root handler on the same stream.
logger.propagate = False
module.logger = logger
module.FLOWS = {}
sys.modules["fluksio"] = module