Python dataclass libraries, pydantic and dataclass-wizard
It started with writing type hints for a complex dict, which led me to TypedDict, slowly went into “why can’t I just do a dataclass as with the rest”.
Found two libraries:
- pydantic
- Really nice esp. for validation
MyClass(**somedict)
- Couldn’t find an easy way to parse nested dataclasses from the same dict
- Dataclass Wizard
- Basically a wrapper to read/save (nested!) dataclasses from dicts / json.
- Does one thing and does it well!
- When dumping, converted my
field_names
to camelcasefieldNames
, one can disable that from settings: Extending from Meta — Dataclass Wizard 0.22.1 documentation
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus