larztrace
Watch your code run, line by line.
The beginner's execution visualizer: trace a function and it records every line executed and every variable at each step, then prints the step-by-step story of the run. Demystifies loops, branches and how the answer is reached.
larzscript pkg install trace
What you get
- Records every line + variables
- table() and explain() output
- variable_history() over a run
- Built on sys.settrace
Try it
import "trace" as trace
let t = trace.new()
let a = 1
let b = 1
trace.mark(t, "start", {"a": a, "b": b})
a = a + b
trace.mark(t, "after add", {"a": a, "b": b})
print(trace.table(t))
print(trace.variable_history(t, "a"))Output
step | label | a | b 1 | start | 1 | 1 2 | after add | 2 | 1 [1, 2]
Why it's in the Larz Stack
larztrace is a real Larzscript package (larzscript pkg install trace) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.