Skip to content

Latest commit

 

History

History
185 lines (165 loc) · 19 KB

README.md

File metadata and controls

185 lines (165 loc) · 19 KB

pyserde

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

pypi pypi GithubActions CodeCov

Guide🇬🇧 | ガイド🇯🇵 | API Reference | Examples

Overview

pyserde is a simple yet powerful serialization library on top of dataclasses. It allows you to convert Python objects to and from JSON, YAML, and other formats easily and efficiently.

Declare your class with @serde decorator and annotate fields using PEP484 as below.

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

You can serialize Foo object into JSON.

>>> 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.

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

That's it! If you're interested in pyserde, please check our documentation! Happy coding with pyserde! 🚀

Features

Extensions

Contributors ✨

Thanks goes to these wonderful people (emoji key):

yukinarit
yukinarit

💻
Alexander Miskaryan
Alexander Miskaryan

💻
ydylla
ydylla

💻
Kevin Squire
Kevin Squire

💻 📖
Yushi OMOTE
Yushi OMOTE

💻
Yuji Kanagawa
Yuji Kanagawa

💻
Weiliang Li
Weiliang Li

💻
Mauve
Mauve

💻
adsharma
adsharma

💻
Guilhem C.
Guilhem C.

📖
Pierre Tardy
Pierre Tardy

💻
Raphael Nestler
Raphael Nestler

📖
Pranav V P
Pranav V P

💻
andreymal
andreymal

💻
Johann Fuechsl
Johann Fuechsl

💻
DoeringChristian
DoeringChristian

💻
Stuart Axelbrooke
Stuart Axelbrooke

💻
Jakub Beránek
Jakub Beránek

💻
Fredrik Reinholdsen
Fredrik Reinholdsen

💻
Bruno Oliveira
Bruno Oliveira

📖
Kyle Kosic
Kyle Kosic

💻
Gajo Petrovic
Gajo Petrovic

📖
m472
m472

💻
acolley-gel
acolley-gel

💻
Marc-André Allaire
Marc-André Allaire

💻
Ganden Schaffner
Ganden Schaffner

💻
Dave Tapley
Dave Tapley

💻
Beartama
Beartama

💻
Rachael Sexton
Rachael Sexton

💻
JWSong
JWSong

💻
Emanuele Barsanti
Emanuele Barsanti

💻
Aman Clement Aranha
Aman Clement Aranha

📖
𝕂'
𝕂'

📖
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

This project is licensed under the MIT license.