Pre-release
This release is a pre-release and may not be stable for production use.
dataclass-deser 
A simple deserialization library for python based on dataclasses and type hints.
I've written this code repeatedly across several of my scripts, so I've decided to publish it to PyPi for reuse.
Basic Example
@dataclass
class Nested:
foo: int
@dataclass
class Foo:
bar: int
baz: list[int]
nested: Nested
raw_json = """{
"bar": 3,
"baz": [1, 2, 8],
"nested": {"foo": 42}
}"""
expected = Foo(
bar=3,
baz=[1, 2, 8],
nested=Nested(foo=42)
)
ctx = dataclass_deser.DeserContext()
assert expected == ctx.deser(Foo, json.loads(raw_json))
Status
WARNING: This library is ALPHA qUaLitY
- Basic primitive deserialization
- Support lossless numeric conversions (int -> float)
- Support lossy numeric conversion
- Support for optional types
- Support for union types (int | str | bytes)
- Configuration options
- Allow unused keys
- Extensibility
- Field options via dataclass field.metadata
- Newtype wrappers
- Support more collections
- Dictionaries
- Tuples
- Sets
- Support enumerations
Metadata
Release files for dataclass-deser 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dataclass-deser-0.1.0a2.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dataclass_deser-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / dataclass-deser-0.1.0a2.tar.gz
| Download URL | dataclass-deser-0.1.0a2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1be3ccfeb6e91130dec95e5e7f8723c7babc9fd81489c3d0018f2eb0f9ea8c7
|
|
BLAKE2b-256 checksum How to use checksums |
a903a3550109a92619434981ac5c98d22169fa1b9d50fa882d5854aa7abc30ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Release files / dataclass_deser-0.1.0a2-py3-none-any.whl
| Download URL | dataclass_deser-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71f2315109a73272faba07ac8d5441102758962f92e5bbcd24e1faedd185345b
|
|
BLAKE2b-256 checksum How to use checksums |
044c5fae873faaddeade82f2b72e6b9b930b40ac233b5bbd04bacbc5569a2922
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|