Skip to main content

WARNING

bream is currently in pre-alpha development, and does NOT yet have a stable serialisation format.

Any release in the 0.0.x series may contain breaking changes.

Please do test-drive and give feedback, or else check back soon for a stable version!

END WARNING


bream

image image image Actions status

bream is an explictly versioned encode/decode framework targetting JSON-like trees.

Goals and non-goals

bream aims to be the following:

  • Simple: encode to a human-readable JSON tree.
  • Explicit: no silent conversion. User-provided versions, easy upgrades.
  • Modular: bring-your-own codecs.

It does not aim to be fast. Speed isn't a current design goal.

Data structure

A JSON-like tree is a nested combination of dict (with str keys only), list, int, float, str, bool and None.

An bream tree is a dict with some metadata and a payload; any valid JSON tree is a valid payload. For example:

{
    "_bream_spec": 1,
    "_payload": {
        "serialised": ["data", "goes", "here"]
    }
}

Any JSON tree is a valid bream payload.

Encoded objects

Certain JSON trees within a payload represent 'encoded' Python objects. Any such tree is a dict with a particular structure. Here's how complex(0.123, 0.456) might be encoded:

{
    "_type_label": "complex",
    "_version": 1,
    "_payload": {
        "real": 0.123,
        "imag": 0.456
    }
}

The three top-level fields are special:

  • _type_label is a unique label for the type.
  • _version is incremented whenever the structure of _payload needs to change.
  • _payload is some JSON data (that may or may not be a dict).

A Coder is an object which knows how to convert from the payload back to a Python object.

Advantages of versioning

The main advantage of explicitly encoding & decoding your objects with bream is the ability to version the encoded form, and then provide a "compatibility decode" pathway to decode an older encoded representation into the latest in-memory representation.

This also means that upgrading an 'old' file on disk is as simple as decoding then encoding again.

Separating the Coders from the type being encoded also has the advantage that you can write custom serialisation for builtin or third-party types not under your direct control.

Metadata

Release files for bream 0.0.2

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

Source distribution (sdist)

Source distribution for bream 0.0.2
File Size Uploaded Provenance Actions
bream-0.0.2.tar.gz 11.1 kB Without provenance Details for bream-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bream 0.0.2
File Interpreter ABI Platform Actions
bream-0.0.2-py3-none-any.whl Python 3 none any Details for bream-0.0.2-py3-none-any.whl

Total release size: 19.8 kB

Release files / bream-0.0.2.tar.gz

Download URL bream-0.0.2.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e0a3f891ec28b7577d3b0d42cc292be200c291431b42b5a4a528e3872f3033f7
BLAKE2b-256 checksum
How to use checksums
6ea8c7f8e521772818d7782b78a25ce5ca0e0095276bc0f277bba466c4d1bb9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.24

Release files / bream-0.0.2-py3-none-any.whl

Download URL bream-0.0.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1f45c444094db875a71e688f0316c36a7eb97ad4319e3d0b44cbb9242f395ff
BLAKE2b-256 checksum
How to use checksums
68de11c3991d3954446a908199d0b67494f0659e3356ae57cea33a856835f08a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.24

Security for bream 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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