cattrs
cattrs copied to clipboard
Composable custom class converters for attrs, dataclasses and friends.
python version: 3.13.7 attrs version: 25.4.0 cattrs version 25.3.0 When I try to structure a dict into a class, I only see a validation error from one field, when I...
Hi! It seems like currently converter with `omit_if_default=True` does not apply attrs' converters when checking if the value is equal to the default one. ```python import attrs import cattrs c...
functionally this code does what I expect it to (asserts go through) but there is a type error in the signature of `Converter.structure`, it accepts cl: type[T] and UnionType does...
```python import cattrs from attrs import frozen from cattrs import strategies @frozen class Base: pass @frozen class Mid1(Base): pass @frozen class Mid2(Base): pass @frozen class Sub(Mid1, Mid2): pass converter =...
Trivial example: ``` import cattrs import enum import cattr.preconf.json c = cattr.preconf.json.make_converter() class TE(enum.Enum): A = 1 class TE2(enum.Enum): C = TE.A print(repr(c.unstructure(TE2.C))) ``` Outputs: ``` ``` Should output: ```...
```python from __future__ import annotations from attrs import define from cattrs import Converter from cattrs.strategies import configure_tagged_union @define class Add: left: Expr right: Expr type Expr = Add | float...