Skip to main content

selene-formats for Python

Python models for the versioned, serializable Selene trace protocol. See the protocol documentation and JSON Schema in the repository's selene-formats/ directory.

from selene_formats.trace import (
    SCHEMA_VERSION,
    Trace,
    TraceData,
    Traces,
    parse_trace_json,
)

trace = Trace(schema_version=SCHEMA_VERSION, events=[])
traces = Traces(schema_version=SCHEMA_VERSION, traces=[TraceData(events=[])])
upgraded = parse_trace_json(versionless_trace_json)
legacy_json = trace.as_legacy().model_dump_json(indent=2)

as_legacy() returns a LegacyTrace sharing the current event models and validation rules. Its model_dump() and model_dump_json() omit schema_version and keep opaque tags numeric. LegacyTrace also accepts versionless input and defaults its internal version to 0.1.0. Filtering and timing helpers retain legacy serialization. Collections have no legacy format.

For trace streams, use the MessagePack API rather than the JSON document parser:

from selene_formats.trace_stream import iter_trace_stream, write_trace_stream

write_trace_stream("trace.msgpack.gz", trace.events)
for event in iter_trace_stream("trace.msgpack.gz"):
    print(event)

Use iter_trace_stream_records to include instruction metadata. Reads are lazy and uncached, so keep the source file available until iteration finishes. See the stream format for framing and error handling.

Metadata

Release files for selene-formats 0.1.1

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

Source distribution (sdist)

Source distribution for selene-formats 0.1.1
File Size Uploaded
selene_formats-0.1.1.tar.gz 43.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for selene-formats 0.1.1
File Interpreter ABI Platform
selene_formats-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.6 kB

Release files / selene_formats-0.1.1.tar.gz

Download URL selene_formats-0.1.1.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
af0c9c8fab86b1baf062663704d2d9ebdb5ed75ea97cd45b14334d4380d481ca
BLAKE2b-256 checksum
How to use checksums
0a67d3ff97fc194ecf5e5b62f0555ea12143e195da0d38737bc586535fd82944
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 16, 2026.

Transparency log

Release files / selene_formats-0.1.1-py3-none-any.whl

Download URL selene_formats-0.1.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40687003a2877066458b621563101401fd60321765d9a2070ed2320fe05463c8
BLAKE2b-256 checksum
How to use checksums
99c88803bd453af8d15ed8867522ef64381d5cd3143d5ed8ea5fbc583ef5cce8
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 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 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