dataclass_structor
A type aware structor/destructor for python value objects.
Install
pip install dataclass_structor
Documentation
The docs for this project can be found here.
Example
import dataclasses
import typing
from dataclass_structor import structure, unstructure
@dataclasses.dataclass
class Invite:
email: str
guests: typing.List["Guest"]
@dataclasses.dataclass
class Guest:
first_name: typing.Optional[str] = None
value_type = Invite(
email="testing",
guests=[
Guest(first_name="John"),
Guest(),
],
)
x = unstructure(value_type)
assert x == {"email": "", "guests": [{"first_name": "John"}, {"first_name": None}]}
assert structure(x, Invite) == value_type
Release files for dataclass_structor 0.0.6
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_structor-0.0.6.tar.gz | 29.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dataclass_structor-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.4 kB
Release files / dataclass_structor-0.0.6.tar.gz
| Download URL | dataclass_structor-0.0.6.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c437bc3d521c579d818c3158dbc54b21c5401a63c5e331485f6a0f80ed014b2
|
|
BLAKE2b-256 checksum How to use checksums |
4d4c5629b382eafc4c09b7fdfc9b71c0d534fa07d2daaaa350752681ec6dbcc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.19.1
|
Release files / dataclass_structor-0.0.6-py3-none-any.whl
| Download URL | dataclass_structor-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
930690d452b9cb643dc73dc11e6b506349540fe8709f0e47ebfc06648378a9fa
|
|
BLAKE2b-256 checksum How to use checksums |
f5f0841e57be3babfa3f8dff268ec6773bab0048f79670a170f841f4b101f817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.19.1
|