srdatalog.viz.bundle¶
Build the JSON bundle the VS Code extension renders.
One function: get_visualization_bundle(program) returns a dict that
contains HIR, MIR, per-rule JIT, and a summary of the rules. Purely
in-memory — no disk I/O, no compile pipeline rerun on the C++ side.
The shape is stable across Nim and Python ports because both compilers share the same HIR/MIR contract (the byte-match fixture tests guard that invariant). The extension’s language-agnostic renderer consumes this bundle; only the source-manipulation front (parse/patch) is language-specific.
Module Contents¶
Functions¶
Return an in-memory bundle of everything the extension renders. |
API¶
- srdatalog.viz.bundle.get_visualization_bundle(program: srdatalog.dsl.Program, project_name: str = 'VizProject', *, include_jit: bool = True) dict[source]¶
Return an in-memory bundle of everything the extension renders.
Shape: { “hir”: {…}, # HIR JSON (hir_to_obj output) “mir”: “(program …)”, # MIR S-expr “jit”: {name: cpp}, # per-rule complete runner code (omitted if include_jit=False) “rules”: [ {…}, … ], # rule summary for sidebar “project_name”: str, # echo of the arg (for titles) “has_jit”: bool, # whether the JIT block was included }
include_jit=Falseskips emitting the per-rule C++ kernel code. On doop (78 rules, 96 runners) that drops the bundle from ~3 MB to ~300 KB — important for Jupyter cell rerun latency. The HIR / MIR / rule summary are always included since they’re cheap and drive the graph view. Passinclude_jit=True(the CLI default) when the user explicitly wants to inspect generated kernels.