Registry / serialization / spectate

spectate

JSON →
library1.0.1pypypi✓ verified 83d ago

Spectate (v1.0.1) is a Python library designed to track changes to mutable data types, providing undo/redo capabilities for operations on objects like dictionaries and lists. It achieves this by wrapping functions that modify tracked objects, recording events for each change. The library is currently feature-complete and in maintenance mode, with a slow release cadence.

pip install spectate
INSTALL
IMPORT
SIG · SPECTATE
S
spectate
serializationpythonv1.0.1
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

track
import spectate
from spectate import track

This example demonstrates how to use `spectate.track` to observe changes to a dictionary, and then `undo` and `redo` those changes. The `@track` decorator wraps the `add_entry` function, automatically recording each modification to the dictionary `a`.

from spectate import track, undo, redo a = {} @track(a) def add_entry(key, value): a[key] = value add_entry('x', 1) add_entry('y', 2) print(f"Initial state: {a}") undo() print(f"After first undo: {a}") undo() print(f"After second undo: {a}") redo() print(f"After first redo: {a}") redo() print(f"After second redo: {a}")
Debug
Known issues
breakingEvent objects returned by Spectate (e.g., from `spectate.events.current_event()`) are now standard Python dictionaries, not `Immutable` (dict-like) objects with attribute access.
fix
Access event data using standard dictionary key notation (e.g., `event['key']`) instead of attribute access (e.g., `event.key`).
affects: 1.0.0+
breakingThe `spectate.utils.Immutable` class has been completely removed.
fix
Remove any direct imports or references to `spectate.utils.Immutable`. If you were creating custom immutable objects, you'll need to refactor to use standard Python dicts or create your own immutable wrappers.
affects: 1.0.0+
breakingThe `undo` parameter for `spectate.events.rollback()` is now required.
fix
Ensure `spectate.events.rollback()` is called with the `undo` parameter, e.g., `spectate.events.rollback(undo_action_function)`.
affects: 1.0.0+
Upgrade
Version history
1.0.1latest on PyPI · released Mar 5, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
6
OpenAI (training)
1
Resources
spectate — pip install spectate · libregistry