You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Potentially breaking: Unstructuring hooks for typing.Any are consistent now: values are unstructured using their runtime type.
Previously this behavior was underspecified and inconsistent, but followed this rule in the majority of cases.
Reverting old behavior is very dependent on the actual case; ask on the issue tracker if in doubt.
(#473)
Minor change: Heterogeneous tuples are now unstructured into tuples instead of lists by default; this is significantly faster and widely supported by serialization libraries.
(#486)
Minor change: cattrs.gen.make_dict_structure_fn will use the value for the prefer_attrib_converters parameter from the given converter by default now.
If you're using this function directly, the old behavior can be restored by passing in the desired values explicitly.
(#527#528)
Introduce BaseConverter.get_structure_hook and BaseConverter.get_unstructure_hook methods.
(#432#472)
BaseConverter.register_structure_hook, BaseConverter.register_unstructure_hook, BaseConverter.register_unstructure_hook_factory and BaseConverter.register_structure_hook_factory
can now be used as decorators and have gained new features.
See here and here for more details.
(#487)
Introduce and document the cattrs.cols module for better collection customizations.
(#504#540)
Enhance the cattrs.cols.is_mapping predicate function to also cover virtual subclasses of abc.Mapping.
This enables map classes from libraries such as immutables or sortedcontainers to structure out-of-the-box.
(#555#556)
Introduce the msgspecpreconf converter <cattrs.preconf.msgspec>.
Only JSON is supported for now, with other formats supported by msgspec to come later.
(#481)
The default union handler now properly takes renamed fields into account.
(#472)
The default union handler now also handles dataclasses.
(#426#477)
Add support for optionally un/unstructuring named tuples using dictionaries.
(#425#549)
The include_subclasses strategy now fetches the member hooks from the converter (making use of converter defaults) if overrides are not provided, instead of generating new hooks with no overrides.
(#429#472)
The preconf make_converter factories are now correctly typed.
(#481)
The orjson preconf converter now passes through dates and datetimes to orjson while unstructuring, greatly improving speed.
(#463)
cattrs.gen generators now attach metadata to the generated functions, making them introspectable.
(#472)
Structure hook factories in cattrs.gen now handle recursive classes better.
(#540)