v0.0.18¶
New: NamespaceFragment¶
Composable fragments group related nodes, DAG factories, and cached callables
under a shared nsref prefix. Two patterns are supported:
- Class fragment — subclass
NamespaceFragment, decorate methods with@nsnode,@dag_factory,@require_cache. Constructor args come frominit:in the YAML config. Example:SleepFragment(NamespaceFragment). - Module fragment — a plain Python module with decorated top-level
functions. Discovered via
ModuleRefand registered with the same decorators. Example:transforms.pywith@nsnode double,@dag_factory double_dag.
Fragment entries use type: fragment in namespace YAML config with gref,
nsref, optional init (constructor kwargs), and per-node configs
(triggers, cache settings).
Supporting decorators¶
@nsnode(tags=...)— marks a method/function for automatic discovery and registration as aNamespaceNode.@dag_factory— marks a method that returns aDaginstance.@require_cache(ttl=..., db=...)— marks a callable for cache-backed execution vialythonic.compose.cached.
Fragment registration¶
Namespace.from_dict discriminates type: fragment entries, instantiates the
class or imports the module, discovers decorated members, and registers them
with auto-prefixed nsrefs.
New: DagContext.ns_call / ns_acall¶
Call registered namespace nodes from within DAG-participating callables.
ns_call(nsref, *args, **kwargs)— sync dispatch. RaisesTypeErrorif the target is async (usens_acallinstead).ns_acall(nsref, *args, **kwargs)— async dispatch. Handles async targets directly,@inlinesync targets on the event loop, and regular sync targets vialoop.run_in_executor.
DagContext now carries a namespace field (excluded from serialization),
set by DagRunner._call_node.
New: Trigger shorthand¶
TriggerConfig accepts a bare cron string (e.g., "*/13 * * * * *") and
expands it to {type: "poll", schedule: "..."}. Trigger names auto-derive
from the node's nsref leaf when omitted.
New: --verbose flag for CLI¶
Main model includes a verbose: bool field. When --verbose is passed,
ActionTree._run_args prints the full traceback on error instead of just
the message.
Changed¶
EngineConfig.namespacechanged fromlist[NsNodeConfig]tolist[dict[str, Any]]so fragment-specific fields pass through toNamespace.from_dictwithout Pydantic stripping them.GlobalRefnow accepts bound methods (ismethodadded to the callable check).Namespace.get_as_dagsetsparent_namespaceon ad-hoc single-node DAGs, so callables usingDagContext.namespacework correctly.
Fixes¶
- Cache DDL for zero-arg functions —
generate_cache_table_ddlproducedPRIMARY KEY ()for parameterless functions. Fixed: conditional PRIMARY KEY in DDL, empty WHERE in lookup, DELETE-before-INSERT in upsert. - Node failure tracebacks —
DagRunner.run()now capturestraceback.format_exc(), logs it vialogging.error, and stores the full traceback innode_executions.error. - Silent ad-hoc DAG failures —
get_as_dag()created DAGs withoutparent_namespace, causing"DagContext has no namespace"errors for callables usingns_call.