Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Rewind

Capture a Python failure. Replay the observations that caused it.

Rewind records selected dependency calls while your application runs, then uses those recorded observations to reproduce the outcome locally. Replay checks the call order, arguments, and result; a missing or different observation produces a divergence report instead of falling back to a live dependency.

Install the jaysoft-rewind distribution, import rewind, and use the rewind command. The project is maintained by Jay Prakash Sonkar and licensed under the MIT license.

Documentation · Getting started · Source · Changelog

Install 0.2.0a1

This guide covers Rewind 0.2.0a1, an alpha release for Python 3.11 and 3.12.

python -m pip install "jaysoft-rewind==0.2.0a1"
rewind --version

The core package has no mandatory third-party runtime dependencies. Install an optional integration with the matching extra: httpx, fastapi, flask, sqlalchemy, redis, postgres, mysql, kafka, celery, s3, encryption, or all. For example:

python -m pip install "jaysoft-rewind[fastapi]==0.2.0a1"
# Or, for Redis:
python -m pip install "jaysoft-rewind[redis]==0.2.0a1"

See the installation guide for environment setup and version selection.

What you can capture in 0.2.0a1

  • Functions and requests: synchronous or asynchronous callables, FastAPI/ASGI HTTP requests, and Flask/WSGI requests.
  • Dependency observations: HTTPX requests, synchronous SQLite DB-API and SQLAlchemy operations with SQLite, PostgreSQL and MySQL; supported Redis commands and pipelines; explicit Kafka/Celery, filesystem and S3 observations.
  • Sources of variation: explicit time, date, UUID, random, environment, and wait observations through Rewind's source APIs.
  • Optional diagnostics: bounded function-entry, return, exception, and named span events, with dropped-event counts.

The developer tools inspect recordings, replay them in a fresh process, compare changed source against an explicit expected outcome, generate pytest cases, and export or import validated portable archives. Storage, capture limits, retention conditions, and optional background persistence control the amount of data kept.

Adapters are explicit: installing Rewind alone does not intercept your clients or instrument your application. The support matrix provides the tested contracts and exclusions for each integration.

Server workflow

Configure Rewind in the server process, wrap its supported dependencies, and send an ordinary request. Keep every admitted request with Retention(always=True), or use a status/exception/duration condition. Explore a retained artifact with rewind explore snapshot.rewind.json --output report.html, then replay the same handler with rewind replay snapshot.rewind.json --app app:replay_target.

The server tutorial demonstrates a real HTTP 500 caused by an incomplete provider response, followed by reproduction after stopping the server. The HTML explorer works locally and contains the recorded request, dependency calls, handler result or exception, and optional function timeline. It does not upload artifacts.

Optional: try a small callable failure

Save this as rewind_demo.py and run python rewind_demo.py. It uses only synthetic fixture data and the core package.

from tempfile import TemporaryDirectory

from rewind import CapturePolicy, LocalStore, Retention, Rewind

with TemporaryDirectory() as directory:
    store = LocalStore(directory)
    recorder = Rewind(
        application="checkout-demo",
        code_paths=[__file__],
        store=store,
        policy=CapturePolicy.synthetic(),
        retain=Retention(always=True),
    )
    live_calls = 0

    def payment_reply():
        global live_calls
        live_calls += 1
        return {"status": "accepted"}  # The fixture is missing receipt_id.

    def checkout():
        reply = recorder.value("payment.reply", payment_reply)
        return reply["receipt_id"]

    try:
        recorder.run_sync(checkout)
    except KeyError:
        pass

    snapshot = store.load(store.ids()[0])
    report = recorder.replay_sync(snapshot, checkout)
    assert report.reproduced, report.to_dict()
    assert live_calls == 1
    print(report.status)
    print(f"Live provider calls: {live_calls}")

Expected output:

reproduced
Live provider calls: 1

The original execution raises KeyError. Replay produces the same failure from the recorded reply without calling payment_reply again. Reproducing a failure means it was faithfully observed; it does not mean the application has been fixed. Use an explicit expected outcome when comparing a proposed fix.

The temporary recording is removed when this example ends. The getting-started guide shows how to keep artifacts and connect the workflow to your application.

Capture policy and replay boundaries

Capture defaults exclude application values and bodies. The synthetic policy in the example opts into fixture values and exception arguments; use it only with data you know contains no secrets. Named-field redaction, capture limits, and unsupported operations can make an artifact incomplete. Incomplete artifacts remain inspectable and are not eligible for strict replay.

Strict reproduction requires a compatible application fingerprint, Python and adapter environment, policy, and entry point. Changed-source comparison is an explicit separate mode. Replay reproduces supported observations; it does not reconstruct a whole operating system, arbitrary native code, or a distributed service environment. The default fresh-process Python audit guard is a Python-level boundary. Network-disabled Docker verification provides a separate OS-level network boundary for the included examples.

Next steps

Validation and compatibility

The local staging suite measures fixed-arrival load, independent memory use, queue budgets, disable/drain, and rollback. The bundled profile uses synthetic data and stated example budgets. See the compatibility policy for alpha API, schema and release guarantees.

New to Rewind? Read the server walkthrough for a complete first recording, offline replay, and existing-backend example.

Metadata

Release files for jaysoft-rewind 0.2.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jaysoft-rewind 0.2.0a1
File Size Uploaded
jaysoft_rewind-0.2.0a1.tar.gz 265.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jaysoft-rewind 0.2.0a1
File Interpreter ABI Platform
jaysoft_rewind-0.2.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 357.9 kB

Release files / jaysoft_rewind-0.2.0a1.tar.gz

Download URL jaysoft_rewind-0.2.0a1.tar.gz
Size 265.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c16ea6f9c9121fa6ed29cc42fc46b99bfdd4dc33f93d21d7d48bced5136dddd4
BLAKE2b-256 checksum
How to use checksums
2ad13818fb67522392acad042f7fb7838a071fec23f5c342d7d0d02bcdb53937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / jaysoft_rewind-0.2.0a1-py3-none-any.whl

Download URL jaysoft_rewind-0.2.0a1-py3-none-any.whl
Size 92.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bf300f1155c0e6b05d54cd0021f2786db86950a213afef99c44c7303b921681
BLAKE2b-256 checksum
How to use checksums
8fa906cdb4262d0b320ed4a46f5d0087928cc036d02d8bd9ccbfbae7976a1dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page