Metadata-Version: 2.1
Name: pyserde
Version: 0.9.0
Summary: Yet another serialization library on top of dataclasses
Home-page: https://github.com/yukinarit/pyserde
License: MIT
Author: yukinarit
Author-email: yukinarit84@gmail.com
Requires-Python: >=3.7.0,<4.0.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Provides-Extra: all
Provides-Extra: msgpack
Provides-Extra: numpy
Provides-Extra: orjson
Provides-Extra: toml
Provides-Extra: yaml
Requires-Dist: casefy
Requires-Dist: jinja2
Requires-Dist: msgpack; extra == "msgpack" or extra == "all"
Requires-Dist: numpy (>1.21.0); python_version ~= "3.8.0" and (extra == "numpy" or extra == "all")
Requires-Dist: numpy (>1.21.0); python_version ~= "3.9.0" and (extra == "numpy" or extra == "all")
Requires-Dist: numpy (>1.22.0); python_version ~= "3.10" and (extra == "numpy" or extra == "all")
Requires-Dist: numpy (>=1.21.0,<1.22.0); python_version ~= "3.7.0" and (extra == "numpy" or extra == "all")
Requires-Dist: orjson; extra == "orjson" or extra == "all"
Requires-Dist: pyyaml; extra == "yaml" or extra == "all"
Requires-Dist: tomli-w; extra == "toml" or extra == "all"
Requires-Dist: tomli; extra == "toml" or extra == "all"
Requires-Dist: typing_extensions; python_version ~= "3.7.0"
Requires-Dist: typing_inspect (>=0.4.0)
Project-URL: Repository, https://github.com/yukinarit/pyserde
Description-Content-Type: text/markdown

# `pyserde`

Yet another serialization library on top of [dataclasses](https://docs.python.org/3/library/dataclasses.html), inspired by [serde-rs](https://github.com/serde-rs/serde).

[![image](https://img.shields.io/pypi/v/pyserde.svg)](https://pypi.org/project/pyserde/)
[![image](https://img.shields.io/pypi/pyversions/pyserde.svg)](https://pypi.org/project/pyserde/)
![Tests](https://github.com/yukinarit/pyserde/workflows/Tests/badge.svg)
[![codecov](https://codecov.io/gh/yukinarit/pyserde/branch/master/graph/badge.svg)](https://codecov.io/gh/yukinarit/pyserde)

[Guide](https://yukinarit.github.io/pyserde/guide) | [API Docs](https://yukinarit.github.io/pyserde/api/serde.html) | [Examples](./examples)

## Overview

Declare a class with pyserde's `@serde` decorator.

```python
@serde
@dataclass
class Foo:
    i: int
    s: str
    f: float
    b: bool
```

You can serialize `Foo` object into JSON.

```python
>>> to_json(Foo(i=10, s='foo', f=100.0, b=True))
'{"i":10,"s":"foo","f":100.0,"b":true}'
```

You can deserialize JSON into `Foo` object.
```python
>>> from_json(Foo, '{"i": 10, "s": "foo", "f": 100.0, "b": true}')
Foo(i=10, s='foo', f=100.0, b=True)
```

## Features

- Supported data formats
    - dict
    - tuple
    - JSON
	- Yaml
	- Toml
	- MsgPack
- Supported types
    - Primitives (`int`, `float`, `str`, `bool`)
    - Containers (`List`, `Set`, `Tuple`, `Dict`)
    - [`typing.Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)
    - [`typing.Union`](https://docs.python.org/3/library/typing.html#typing.Union)
    - User defined class with [`@dataclass`](https://docs.python.org/3/library/dataclasses.html)
    - [`typing.NewType`](https://docs.python.org/3/library/typing.html#newtype) for primitive types
    - [`typing.Any`](https://docs.python.org/3/library/typing.html#the-any-type)
    - [`typing.Generic`](https://docs.python.org/3/library/typing.html#user-defined-generic-types)
    - [`Enum`](https://docs.python.org/3/library/enum.html#enum.Enum) and [`IntEnum`](https://docs.python.org/3/library/enum.html#enum.IntEnum)
    - Standard library
        - [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html)
        - [`decimal.Decimal`](https://docs.python.org/3/library/decimal.html)
        - [`uuid.UUID`](https://docs.python.org/3/library/uuid.html)
        - [`datetime.date`](https://docs.python.org/3/library/datetime.html#date-objects), [`datetime.time`](https://docs.python.org/3/library/datetime.html#time-objects), [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime-objects)
        - [`ipaddress`](https://docs.python.org/3/library/ipaddress.html)
    - PyPI library
        - [`numpy`](https://github.com/numpy/numpy) types
- [Attributes](docs/features/attributes.md)
- [Decorators](docs/features/decorators.md)
- [TypeCheck](docs/features/type-check.md)
- [Union Representation](docs/features/union.md)
- [Python 3.10 Union operator](docs/features/union-operator.md)
- [Python 3.9 type hinting](docs/features/python3.9-type-hinting.md)
- [Postponed evaluation of type annotation](docs/features/postponed-evaluation-of-type-annotation.md)
- [Forward reference](docs/features/forward-reference.md)
- [Case Conversion](docs/features/case-conversion.md)
- [Rename](docs/features/rename.md)
- [Skip](docs/features/skip.md)
- [Conditional Skip](docs/features/conditional-skip.md)
- [Custom field (de)serializer](docs/features/custom-field-serializer.md)
- [Custom class (de)serializer](docs/features/custom-class-serializer.md)
- [Flatten](docs/features/flatten.md)

## LICENSE

This project is licensed under the [MIT license](https://github.com/yukinarit/pyserde/blob/master/LICENSE).

