Skip to main content

Transparent Time-Travel Tracker: trace object states over time

Project description

t4racker

PyPI Tests

Transparent time-travel tracker for Python objects. Records mutations to dicts, sets, lists, and custom objects—then replay state at any step.

Install

pip install t4racker

Usage

from t4racker import TTTTracker, TrackReplayer


class Algorithm:
    def __init__(self):
        self.visited = set()
        self.path = []


tracker = TTTTracker()
algo = Algorithm()
tracker.track(algo, tracked_fields=['visited', 'path'])
tracker.capture_snapshot('start')

algo.visited.add('A')
algo.path.append('A')
algo.visited.add('B')
algo.path.append('B')

# Export
data = tracker.to_dict()

# Replay
replayer = TrackReplayer(data)
state = replayer.state_at(2)  # State after step 2
print(state)  # {'visited': {'A', 'B'}, 'path': ['A']}

What it tracks

  • dict: __setitem__, __delitem__
  • set: add, remove, discard
  • list: append, pop, __setitem__, clear, extend
  • Custom objects: attribute assignments

Nested containers are tracked recursively.

Tests

pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

t4racker-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

t4racker-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file t4racker-0.1.0.tar.gz.

File metadata

  • Download URL: t4racker-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Darwin/23.4.0

File hashes

Hashes for t4racker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd0c7b54af105a012c518918f5a063f9cbad4dcd1c74ceb09d7b3335dac92372
MD5 93927b2906355f72d8a9eace89384166
BLAKE2b-256 f9ceb9876ad6401f4b0bed0222f845ac308bffa5330d5dcf31a950477e0b1028

See more details on using hashes here.

File details

Details for the file t4racker-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: t4racker-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Darwin/23.4.0

File hashes

Hashes for t4racker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c94cd761a4c238b304453359f37b1c2ce4987425c04ae7d23bdeab382ff58ea3
MD5 cbd4aa4cdc6558c3f0f1229f04fbcc0d
BLAKE2b-256 23e345710bc016e8094fd8cd906daea0d3e24cf83d2fad72bcb950d3bcbc63c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page