Metadata-Version: 2.4
Name: parityos-serialization
Version: 0.1.0
Summary: Simple automatic (de)serialization of custom classes
Project-URL: Documentation, https://docs.parityqc.com/parityos-serialization/latest
Project-URL: Homepage, https://parityqc.com/
Author-email: ParityQC <parityos@parityqc.com>
License-Expression: BSD-3-Clause
License-File: LICENSE.txt
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: attrs<26.0
Requires-Dist: typing-extensions
Description-Content-Type: text/markdown

# ParityOS Serialization

A simple automatic serialization library that is largely inspired by [cattrs](https://github.com/python-attrs/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](https://github.com/python-attrs/attrs) classes or dataclasses and custom (de)serialization hooks which can be registered for custom classes. This is similar to [json](https://docs.python.org/3/library/json.html#module-json)'s `default` parameter to [`dump`](https://docs.python.org/3/library/json.html#json.dump) and `object_hook` parameter to [`load`](https://docs.python.org/3/library/json.html#json.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](https://docs.parityqc.com/parityos-serialization/latest)

## Installation

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

```shell
# 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.:

```shell
# 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.
