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.

JSON schema support:

  • Parsing helpers read 0.1.0, 0.2.0, and versionless legacy traces, normalizing them to the current model.
  • Versioned models and JSON output use 0.2.0.
  • Measurement types are non-empty strings. FutureResultValue accepts strings, numbers, booleans, nulls, arrays, and objects within the protocol's numeric bounds. Object keys are strings, and values follow these rules recursively. Parsing and serialization preserve unfamiliar types and supported result shapes; interpretation requires type-specific support.

Gzipped MessagePack stream readers accept schema versions 0.1.0 and 0.2.0. Stream writers emit schema 0.2.0 using transport format_version: 1.

FutureRead and FutureResult describe runtime future reads in general. Measurement futures can be linked to their Measurement event and qubit through result_id. Other runtime futures do not require a measurement or qubit reference.

See package and schema compatibility for support by package release.

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)
json_text = upgraded.model_dump_json(indent=2)

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.2.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 selene-formats 0.2.0
File Size Uploaded Provenance Actions
selene_formats-0.2.0.tar.gz 58.5 kB With provenance Details for selene_formats-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 73.9 kB

Release files / selene_formats-0.2.0.tar.gz

Download URL selene_formats-0.2.0.tar.gz
Size 58.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3ea209aeac9f79859ee253cc226e91dda68cc712df17840c1d17c5b0fa289d06
BLAKE2b-256 checksum
How to use checksums
fd8dbf0168b00a0deb37d8f715a29f55e90c82ca67d4d3ec62e913a68e749967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

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

Download URL selene_formats-0.2.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a689d0d0919622efbff6948e18cb57c7294d0367d122ff164b02bada5a49220
BLAKE2b-256 checksum
How to use checksums
5b3d715a44a4f8aeccc89d0a83e4ed4ae67f1f2205399cea47bb6447324cc6c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Security for selene-formats 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for selene_formats-0.2.0.tar.gz

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 Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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