cattrs
cattrs copied to clipboard
Composable custom class converters for attrs, dataclasses and friends.
This PR adds an `omit_if` parameter to cattrs unstructure generators (as described [here](https://github.com/python-attrs/cattrs/issues/639#issuecomment-2764377855)), which is similar in function to `omit_if_default` but evaluates a callable at unstructure invoke in order to...
Just a heads-up of a deprecation message emitted in Python3.14 ``` /opt/hostedtoolcache/Python/3.14.0-alpha.6/x64/lib/python3.14/site-packages/cattrs/preconf/json.py:54: in make_converter configure_converter(res) args = () kwargs = {'unstruct_collection_overrides': {: , : }} res = /opt/hostedtoolcache/Python/3.14.0-alpha.6/x64/lib/python3.14/site-packages/cattrs/preconf/json.py:35: in configure_converter...
Here's a simple implementation of using `Annotated` to provide field overrides. Please let me know where's the best place for this code or feel free to move it somewhere else....
* cattrs version: 24.1.2 * Python version: 3.11 * Operating System: Linux ### Description Use an enum's value as the default of a class (instead of the enum reference) causes...
Pyright flags the code below with "Type of "make_converter" is partially unknown". ``` converter = cattrs.preconf.json.make_converter() ``` The problem is the type of the parameter unstruct_collection_overrides: Mapping[type, (...) -> Unknown]....