cattrs v0.5.0 Release Notes
Release Date: 2017-12-11 // over 6 years ago-
- 👍 structure/unstructure now supports using functions as well as classes for deciding the appropriate function.
- added
Converter.register_structure_hook_func
, to register a function instead of a class for determining handler func. - added
Converter.register_unstructure_hook_func
, to register a function instead of a class for determining handler func. - vendored typing is no longer needed, nor provided.
- 0️⃣ Attributes with default values can now be structured if they are missing in the input.
(
#15 <https://github.com/python-attrs/cattrs/pull/15>
_) - |
Optional
attributes can no longer be structured if they are missing in the input. | In other words, this no longer works: | | .. code-block:: python | | @attr.s | class A: | a: Optional[int] = attr.ib() | | >>> cattr.structure({}, A) | - 🚚
cattr.typed
removed since the functionality is now present inattrs
itself. Replace instances ofcattr.typed(type)
withattr.ib(type=type)
.