Reference
ormaos.record()
Records a block of a script or a notebook cell into .ormaos/, like ormaos run, with the same options and the same reading verbs.
import ormaos
with ormaos.record():
main()The block is recorded into .ormaos/ like a run, with the Python processes started inside it, and is read with the same commands. Only what runs inside the block is recorded.
Options#
| Option | Default | What |
|---|---|---|
path | none | a scope, or a list of scopes, recorded line by line: "job.py:sync_orders" |
io | True | False records no I/O |
only | all | the capabilities to record, "calls,io" or a list. A name that is not a capability raises ValueError when record is called, before the block |
values | False | True is the same as --values |
summary | False | True prints the short summary on stderr when the block ends; nothing is printed without it |
root | ./.ormaos | the folder for the recordings. The reading commands only read ./.ormaos |
What it gives#
The object of with ormaos.record() as rec: has name (r3), directory and reason (why nothing is recorded, when that is the case).
Fail open#
- If the recording cannot start, the block runs unrecorded and nothing is raised or printed.
- An exception of the block goes through unchanged.
- Under
ormaos run, the block is part of that recording.
In a notebook#
In a Jupyter notebook the cells are your code. Each cell that runs a block makes a recording:
$ 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 r4The kernel gives every cell a temporary file name, so calls are recorded under that name, not under the cell's number; the recording says so. See the notebook guide.
What the block changes#
It sets ORMAOS_DIR, ORMAOS_PATH and ORMAOS_IO (and ORMAOS_CAPABILITIES with only=, ORMAOS_VALUES with values=True) in os.environ while it runs, and puts each back when it ends. A thread that was already running when the block started has only the calls it starts inside the block recorded. It reads the git commit from the files of .git and says that uncommitted changes were not checked.