Slide 16
Slide 16 text
serde好きすぎて..
03
16
Pythonで使えるserdeのようなライブラリ作ってます
@serde(rename_all=”constcase”)
@dataclass
class Foo:
a: int
b: list[Bar]
c: dist[str, Path] = field(skip_if_false=True)
d: Bar = field(flatten=True)
>>> f = Foo(1, [Bar(2)], {}, Bar(3))
>>> print(to_json(f))
{"A":1,"B":[{"v":2}],"V":3}
● JSON, YAML, TOML, MsgPack, Pickle
● Optional, Union, Generic, ClassVar etc.
● pathlib.Path, Decimal, UUID etc.
● Some numpy types
● rename, skip_if, alias
● Field & Class level custom (de)serializer
● flatten