Skip to main content

Yet another serialization library on top of dataclasses

Project description

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:

Made with contrib.rocks.

LICENSE

This project is licensed under the MIT license.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyserde-0.31.5.tar.gz (522.7 kB view details)

Uploaded Source

Built Distribution

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

pyserde-0.31.5-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file pyserde-0.31.5.tar.gz.

File metadata

  • Download URL: pyserde-0.31.5.tar.gz
  • Upload date:
  • Size: 522.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyserde-0.31.5.tar.gz
Algorithm Hash digest
SHA256 6f22803a859588e1f5c81e5dfff2e0e8e13b75c41a5864a8abea9a71c37341b6
MD5 8f91ed932e8a050ec820a355e37970ec
BLAKE2b-256 3849143c9c6e5f714347306c5e911700fbe2ae8250ca5f154fc6d5d41fe68ace

See more details on using hashes here.

File details

Details for the file pyserde-0.31.5-py3-none-any.whl.

File metadata

  • Download URL: pyserde-0.31.5-py3-none-any.whl
  • Upload date:
  • Size: 51.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyserde-0.31.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0631592e3a6e63c8b20a00970b51abfc99b9a2c262a03320d86a46c98d2a3d3a
MD5 514d6e5134f7cd2d2d4f42dd810694a0
BLAKE2b-256 1965a4b92d9f786e2854b5aa71c606433014c5b894f21383ad84a32e6e7bd7ce

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