Skip to content

Snapshots & rollbacks

Maturity labels

  • Now: Stable and supported in current releases.
  • Preview: Usable today, but behavior and APIs may evolve.
  • Planned: Not yet implemented.

Note

Status: Now

1) What it solves

Interactive edits are error-prone. If one mutation fails validation, you want to keep the last good state and continue.

2) The idea

With interactive mode enabled, Omnipy snapshots validated model state and rolls back on failed mutations.

3) Example

>>> import omnipy as om
>>> om.runtime.config.data.model.interactive = True
>>> xs = om.Model[list[int]]([1, 2, 3])
>>> try:
...     xs.append('oops')
... except Exception as err:
...     print(type(err).__name__)
>>> xs
ValidationError

4) Output / display

╭──────────────────╮
Model[list[int]]
                
[1, 2, 3]
╰──────────────────╯

5) When to use / when not

Use it in notebook-first and exploration-heavy workflows.

Disable it for tight batch loops if you need to reduce snapshot overhead.

6) Gotchas

  • Validation still happens when interactive mode is off.
  • Only rollback behavior changes.