Skip to main content

Simple automatic (de)serialization of custom classes

Project description

ParityOS Serialization

A simple automatic serialization library that is largely inspired by cattrs. It shares cattrs's philosophy of being non-intrusive and not requiring subclassing or abstract method implementation. Instead it relies on automatic object structure deduction for attrs classes or dataclasses and custom (de)serialization hooks which can be registered for custom classes. This is similar to json's default parameter to dump and object_hook parameter to load.

However with respect to cattrs it comes with some significant differences:

  • All objects are serialized together with a unique class tag and the serializer relies on this information for deserialization, rather than type annotations of target fields. This alleviates many troubles cattrs has with deserializing subclasses of types used as type annotations.
  • It inspects the object to serialize, not just its type, which allows e.g. serialization of classes themselves.
  • It doesn't care about generics and typevars as all concrete type information is recorded in the serialized data. This especially allows for greater flexibility with using subclasses of generics.

For more information see the documentation

Installation

It is recommended to install this package in a separate Python virtual environment. For example:

# To create a standard Python virtual environment:
python -m venv my_new_venv && source my_new_venv/bin/activate
# Alternatively, to create a Anaconda/Miniconda environment:
conda create --name my_new_conda_env python=<version> && conda activate my_new_conda_env
# or a pyenv environment
pyenv virtualenv <version> my_new_venv && pyenv activate my_new_venv
# or a uv managed environment
uv venv -p <version>

where <version> is a python version and one of [3.11, 3.12, 3.13].

After activating the virtual environment, install via your favorite package manager, e.g.:

# using pip
pip install parityos-serialization
# using uv
uv pip install parityos-serialization

License

This software package is made available under the 3-Clause BSD License. See License.txt for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parityos_serialization-0.1.0.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parityos_serialization-0.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file parityos_serialization-0.1.0.tar.gz.

File metadata

  • Download URL: parityos_serialization-0.1.0.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for parityos_serialization-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b7c528d7eec4404fae43d8df3b7fe8bf28a50de33f8906434fcfbb80230ae70
MD5 bfea6921b96f29ecd9762aa42e37ddcc
BLAKE2b-256 61222569b18153acf2f26860f8af8b2655d816da4040c6a1ccbebf4c059203b1

See more details on using hashes here.

File details

Details for the file parityos_serialization-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: parityos_serialization-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for parityos_serialization-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c35f18eeefaacd4711d2fb816a8ceb2a188033677f5fb9c81b62c5cb5efe3cbf
MD5 e5394ad351c791edb186a07e2e096eb5
BLAKE2b-256 01dc1a50bdd27c2cde565c2e711e82f828168632124c283797a4511cc055803a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page