yukinarit/pyserde

Created Dec 30, 2020 · View the yukinarit/pyserde repository page

Yet another serialization library on top of dataclasses, inspired by serde-rs.

Want this for your repo?

Render a free sample of any GitHub repo in seconds.

Visualize your own →

Contributors

6

Lines of Code

667

From

Dec 6, 2018

To

Nov 29, 2020

About yukinarit/pyserde

Pyserde is a serialization library that builds on Python's dataclasses to simplify converting objects to and from various data formats. You decorate a dataclass with the @serde decorator and use standard type annotations, then instantly gain the ability to serialize and deserialize your objects into JSON, YAML, TOML, MessagePack, pickle, dictionaries, and tuples. The library handles a comprehensive range of Python types including primitives, standard containers, Optional and Union types, nested dataclasses, Enums, and various standard library types like Path, Decimal, UUID, and datetime objects.

The project offers substantial customization options for fine-tuning serialization behavior. You can rename fields during serialization, skip fields conditionally, apply custom serializers at the field or class level, perform case conversion across all fields, and flatten nested structures. It also supports advanced typing features from recent Python standards like PEP 604 union syntax, PEP 695 type parameters, and forward references. The library includes experimental support for NumPy types and SQLAlchemy Declarative Dataclass Mapping.

Pyserde is inspired by the Rust serde library and aims to provide a simple yet powerful approach to serialization. It includes comprehensive documentation with getting started guides, API references, and examples. The project is actively maintained with community contributions and is distributed under the MIT license.

Share this video

More from yukinarit

See all →