Skip to main content

Python Event package

This directory is the native Python implementation of the Event trajectory facility and the installable runfold-event distribution. The public SDK and its implementation intentionally ship as one in-process package; there is no TypeScript bridge or server client.

python/
├── pyproject.toml
├── src/runfold/event/  # Public API and complete implementation
└── tests/              # Unit, integration, and package-consumer tests

Unlike the TypeScript extraction, Python has no retained DSH package workspaces to wrap. src/runfold/event/__init__.py defines the supported public API, while the sibling modules contain Session, surface, repair, message, chunk codec, and JSONL persistence behavior.

Install and use

pip install runfold-event
from runfold.event import JsonlSessionPersistence, SessionStore, create_user_message

persistence = JsonlSessionPersistence("./sessions", compression="none")
store = SessionStore(persistence)
session = store.create("example", meta={"cwd": "/workspace"})
session.append("turn/start", {"turn": 1})
session.append(
    "user/message",
    create_user_message(
        content=[{"type": "text", "text": "hello"}],
        source={"kind": "user"},
    ),
    surface_op="append",
)
session.append("turn/end", {"turn": 1, "reason": {"kind": "completed"}})
store.close()

Python 3.14 uses standard-library Zstandard support. On Python 3.10–3.13, install runfold-event[zstd]; plaintext JSONL needs no optional dependency.

The implementation preserves DSH format v0 field names and behavior while using Runfold package names. Shared cross-language fixtures live under conformance/event/v0/.

The package is developed and maintained by Heiki Scott under the Perix.ai project name and distributed under the MIT License. DeepSeek Harness provenance and the distinction between retained behavior and the native Python implementation are recorded in NOTICE.md.

Run the Python suite from the repository root:

npm run test:python
npm run test:python:package

The current Python suite has 36 behavior tests. The package-consumer command builds a wheel in an isolated builder, installs only that artifact with --no-index into a second blank environment, and rejects imports from the source tree. The root cross-language suite also exercises plain and Zstandard files in both directions through Python's public restore/resume methods and TypeScript's public runtime.restore(); Python-generated Events are rendered by the TypeScript Trajectory UI.

The public API and exact TypeScript/Python behavior mapping are documented in docs/event/specification.md.

Metadata

Release files for runfold-event 0.1.0

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

Source distribution (sdist)

Source distribution for runfold-event 0.1.0
File Size Uploaded
runfold_event-0.1.0.tar.gz 37.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runfold-event 0.1.0
File Interpreter ABI Platform
runfold_event-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.5 kB

Release files / runfold_event-0.1.0.tar.gz

Download URL runfold_event-0.1.0.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9052313fd995a3c3eac65f1cf610f179ae42f9f117f4486f5aa983dd74bc06f7
BLAKE2b-256 checksum
How to use checksums
6c231386bed4f474c10e6acfe70f1fd6434020e4febe3645b9a18926f4d19555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / runfold_event-0.1.0-py3-none-any.whl

Download URL runfold_event-0.1.0-py3-none-any.whl
Size 34.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3abf20be1a78a3635f76f648e3c6023b69cd10a72a70d2f3ba67e1fa9b5f5883
BLAKE2b-256 checksum
How to use checksums
15b3880b5cf3ab8931b036692fe718d656b7f9dbdb72c045ac29b0089e2d733b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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