OrmaosDocs

Examples

notebook

A Jupyter notebook of weekly sales with tax whose cells record their own steps with ormaos.record().

View as Markdown

A Jupyter notebook, report.ipynb, that reads the sales of the week from sales.csv, leaves out single sales above 1000 (the key-account team handles those), adds tax and sums the week. Four of its cells run their step inside with ormaos.record():, so each step of a session is recorded as it runs.

Run it#

run_notebook.py runs the cells from top to bottom in a new kernel with nbclient, writes the result to report.executed.ipynb and prints what the last cell printed. Or open report.ipynb in Jupyter and run the cells by hand.

bash
pip install -r requirements.txt
pip install git+https://github.com/ormaos/ormaos-python
python run_notebook.py
notebook
$ python run_notebook.py
week total with tax: 47498.40
[IPKernelApp] WARNING | Kernel is running over TCP without encryption. All communication (including code and outputs) is sent in plain text and is susceptible to eavesdropping. Use IPC transport or launch with kernel manager-provisioned CurveZMQ keys to enable transport encryption.

Recorded#

The cells record themselves: there is no ormaos run. Each block is one recording.

notebook
$ ormaos list
4 recordings in .ormaos, newest first
r4  2026-11-27 12:00:00  complete  record() block  …  1 process, 2 calls, 0 exceptions (0 swallowed)  /tmp/ormaos-docs-generate/venv/bin/python ipykernel_launcher
r3  2026-11-27 12:00:00  complete  record() block  …  1 process, 1 call, 0 exceptions (0 swallowed)  /tmp/ormaos-docs-generate/venv/bin/python ipykernel_launcher
r2  2026-11-27 12:00:00  complete  record() block  …  1 process, 1 call, 0 exceptions (0 swallowed)  /tmp/ormaos-docs-generate/venv/bin/python ipykernel_launcher
r1  2026-11-27 12:00:00  complete  record() block  …  1 process, 1 call, 1 exception (0 swallowed), 1 io  /tmp/ormaos-docs-generate/venv/bin/python ipykernel_launcher
next: ormaos show r4 | ormaos show r3 | ormaos show r2 | ormaos diff r3 r4
notebook
$ ormaos tree r2
r2:c1 drop_key_accounts(rows: list[40 dict]) -> list[34 dict]  /tmp/ipykernel_…/1887773198.py:17  …  task 1
next: ormaos exceptions r2