Skip to main content
https://badge.fury.io/py/zerial.png https://travis-ci.org/jriddy/zerial.png?branch=master

Zerial is the serialization tool that allows your model classes to be the Zingle Zource of Truth™ for your project. Let your model classes take whatever form or use whatever collection types they need, and just use metadata to define how that text gets serialized. With support for variant record types, you can even evolve your data models over time, and even create versioned models if need be.

Zerial is built on top of the excellent attrs library, which makes class creation and definition in Python very easy and very obvious. This library adds abritrarily recursive serialization and de-serialization of complex data classes.

Zerial was inspired because complex applications in spaces where requirements are hard to define up front call for a unique approach to modeling data. A solution has to be flexible enough to accomodate a growing and changing understanding of the underlying problem domain, while being rigorous enough to encapsulate these changes to data modules. External schemas like ORM or JSON Schema are both inflexible and instrinsically bound to specific data exchange formats (SQL and JSON) that you may or may not want to actually use. Implicit schemas, although sufficienty flexible, ultimately fail because they break separation of concerns, requiring every bit of code that touches data to understand how to create a validate an entire history of model versions for that data type.

This project aims to allow components to structure their data in a way that is convenient for people interacting with the code, provided that it can be destructured into simple types. The combination of attrs’ rich support for defaults and value factories and zerial’s support of variant records, you can evolve your data models over time, without breaking your client code or stored serialized data.

Features

  • Stucturing and destructuring of model classes

  • Supports rich typing without any runtime dependency on stuff from the typing module, which has deeply inconsistent runtime behavior

  • Model fields can be simple types or other model classes

  • Collection types can be represented as any kind of Python object, as long as you can convert it to and from a list or dict with string keys.

  • Variant records permit fields that accept multiple types of data, permitting extensibility. Variants with default types allow this to be added at any point in development (and even permits for versioned data models).

Todo/Roadmap

  1. Optional native support for numpy arrays

  2. Export of schema definition formats from record classes

  3. Debug tools for destructure/restructure failures

  4. Wrappers around attr.s and attr.ib to make defining models cleaner

  5. Better automated checking and testing tools for serializability

  6. More extensive documentation

Documentation

The full documentation is at http://zerial.rtfd.org.

History

0.1.0 (2018-10-21)

  • First release on PyPI.

Metadata

Release files for zerial 0.2.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 zerial 0.2.1
File Size Uploaded
zerial-0.2.1.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zerial 0.2.1
File Interpreter ABI Platform
zerial-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 27.9 kB

Release files / zerial-0.2.1.tar.gz

Download URL zerial-0.2.1.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49fbcba9f0d3a6bc69ed10354f04410d6876ed4791026ce5b6075aed1ea08c40
BLAKE2b-256 checksum
How to use checksums
98eb8ab0c4741b437dfa5d91c6eec28f0b780b14993ce00e60c9fec1afc92f0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / zerial-0.2.1-py2.py3-none-any.whl

Download URL zerial-0.2.1-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ac7fde077dbfe518b6378611724c491da77e7eb2785ea8571eb1dd2db312bad8
BLAKE2b-256 checksum
How to use checksums
afc83bd1ace4f1e9a672d9baaff683988b0f9cd9aae9817bafb7abab5fbd6c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

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