srdatalog.viz.introspect¶
Import a user’s .py program file and find its Program instance.
The auto-generated files produced by tools/nim_to_dsl.py all follow
the same shape:
def build_<name>_program(meta: dict[str, int] | None = None) -> Program:
...
Users can also write programs that just construct a Program at module
top level. This module handles both shapes and plumbs optional
meta.json + entry overrides through.
Module Contents¶
Functions¶
Import the .py file, discover and invoke a Program builder. |
API¶
- exception srdatalog.viz.introspect.ProgramDiscoveryError[source]¶
Bases:
RuntimeErrorRaised when
load_programcan’t find or build a Program.Initialization
Initialize self. See help(type(self)) for accurate signature.
- srdatalog.viz.introspect.load_program(path: str | pathlib.Path, *, entry: str | None = None, meta: dict | str | pathlib.Path | None = None) srdatalog.dsl.Program[source]¶
Import the .py file, discover and invoke a Program builder.
Discovery order (stops at first match):
entryarg — explicit function name; takes precedence.A top-level callable matching
build_*_program.A module-level
Programinstance (non-callable).
meta— dataset_const metadata. Passed to the builder if the builder accepts a positional arg. Can be:dict: passed as-is
str / Path: loaded as JSON
None: builder called with no args