cattrs
cattrs copied to clipboard
Composable custom class converters for attrs, dataclasses and friends.
* cattrs version: 1.0.0 * Python version: 3.7 * Operating System: MacOS ### Description When creating a `copy.deepcopy` of a cattrs `Converter` instance, and registering structure/unstructure hooks to the copy,...
* cattrs version: 1.8.0 * Python version: 3.8 * Operating System: PopOS ### Description The current implementation of `adapted_fields` check first if the type if a dataclass when you should...
* cattrs version: 22.1.0 * Python version: 3.10.4 * Operating System: Ubuntu ### Description Hi, awesome library! Pushing the limits here :) As named, Literal don't seem to work when...
* cattrs version: 22.1.0 * Python version: 3.9.10 * Operating System: macOS Big Sur (11.5.2) ### Description Passing a dictionary to `structure` that has missing entries for `Optional` values results...
* cattrs version: 22.1.0.dev0 * Python version: 3.7 * Operating System: Ubuntu 16.04 ### Description Orjson doesn't like it when classes have union types as entries. It doesn't always happen,...
I have something like the following: ```py from abc import ABC import attrs @attrs.define class Pet(ABC): name: str age: int @attrs.define class Cat(Pet): color: str @attrs.define class Dog(Pet): tricks: list[str]...
* cattrs version: 1.10.0 * Python version: 3.9.7 * Operating System: MacOS 11.4 ### Description I'm registering two structure hooks which should help me transform my object into a dict...
I am trying to unstructure and structure an Enum like this: ``` from cattr import structure, unstructure class CatBreed(Enum): SIAMESE = "siamese" MAINE_COON = "maine_coon" SACRED_BIRMAN = "birman" a =...
This adds ForwardRef support to cattr (See #201). - ForwardRefs in classes ``` @dataclass class Test: x: List["XType"] XType = int ``` - Recursive classes ``` @dataclass class Node: data:...
* cattrs version: 1.10.0 * attrs version: 21.4.0 * Python version: 3.8.12 * Operating System: Manjaro Linux ### Description I'm yet to get a minimal working example, but it's something...