Skip to main content

Databind is a library inspired by jackson-databind to de-/serialize Python dataclasses. Compatible with Python 3.7 and newer.

Project description

databind.core

databind.core provides a jackson-databind inspired framework for data de-/serialization in Python. Unless you are looking to implement support for de-/serializing new data formats, the databind.core package alone might not be what you are looking for (unless you want to use databind.core.dataclasses as a drop-in replacement to the standard library dataclasses module, for that check out the section at the bottom).

Known implementations

Dataclass extension

The standard library dataclasses module does not allow to define non-default arguments after default arguments. You can use databind.core.dataclasses as a drop-in replacement to get this feature. It behaves exactly like the standard library, only that non-default arguments may follow default arguments. Such arguments can be passed to the constructor as positional or keyword arguments.

from databind.core import dataclasses

@dataclasses.dataclass
class A:
  value1: int = 42

@dataclasses.dataclass
class B(A):
  value2: str

print(B(0, 'Hello, World!'))
print(B(value2='Answer to the universe'))

Copyright © 2020 – Niklas Rosenstein

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

databind.core-4.1.1.tar.gz (23.5 kB view hashes)

Uploaded Source

Built Distribution

databind.core-4.1.1-py3-none-any.whl (26.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page