- Potentially breaking: Sequences are now structured into tuples.
This allows hashability, better immutability and is more consistent with thecollections.abc.Sequence
type. See Migrations for steps to restore legacy behavior. (#663) - Add a
use_alias
parameter tocattrs.Converter
.
cattrs.gen.make_dict_unstructure_fn_from_attrs
,cattrs.gen.make_dict_unstructure_fn
,
cattrs.gen.make_dict_structure_fn_from_attrs
,cattrs.gen.make_dict_structure_fn
andcattrs.gen.typeddicts.make_dict_structure_fn
will use the value for theuse_alias
parameter from the given converter by default now. If you're using these functions directly, the old behavior can be restored by passing in the desired value directly. (#596 #660) - The union passthrough strategy now by default accepts ints for unions that contain floats but not ints,
when configured to be able to handle both ints and floats. This more closely matches the current typing behavior. (#656 #668) - Fix unstructuring of generic classes with stringified annotations. (#661 #662)
- For
cattrs.errors.StructureHandlerNotFoundError
andcattrs.errors.ForbiddenExtraKeysError
correctly setBaseException.args
insuper()
and hence make them pickable. (#666) - The default disambiguation hook factory is now only enabled for converters with
unstructure_strat=AS_DICT
(the default).
Since the strategy doesn't support tuples, it is skipped forunstructure_strat=AS_TUPLE
converters. (#673) - Switch to
uv
andjust
in lieu of PDM, tox and Make. See the Contributing section for new workflow instructions. (#671)
New Contributors
- @hoodmane made their first contribution in #665
- @carltongibson made their first contribution in #677
Full Changelog: v25.1.1...v25.2.0