cattrs v22.2.0 Release Notes

Release Date: 2022-10-03 // over 1 year ago
    • Potentially breaking: cattrs.Converter has been renamed to cattrs.BaseConverter, and cattrs.GenConverter to cattrs.Converter. The GenConverter name is still available for backwards compatibility, but is deprecated. If you were depending on functionality specific to the old Converter, change your import to from cattrs import BaseConverter.
    • ๐Ÿ“„ NewTypes <>_ are now supported by the cattrs.Converter. (#255 <>, #94 <>, #297 <>_)
    • cattrs.Converter and cattrs.BaseConverter can now copy themselves using the copy method. (#284 <>_)
    • ๐Ÿ‘ Python 3.11 support.
    • ๐Ÿ‘ cattrs now supports un/structuring kw_only fields on attrs classes into/from dictionaries. (#247 <>_)
    • โช PyPy support (and tests, using a minimal Hypothesis profile) restored. (#253 <>_)
    • ๐Ÿ›  Fix propagating the detailed_validation flag to mapping and counter structuring generators.
    • Fix typing.Set applying too broadly when used with the GenConverter.unstruct_collection_overrides parameter on Python versions below 3.9. Switch to typing.AbstractSet on those versions to restore the old behavior. (#264 <>_)
    • ๐Ÿ“Œ Uncap the required Python version, to avoid problems detailed in (#275 <>_)
    • Fix Converter.register_structure_hook_factory and cattrs.gen.make_dict_unstructure_fn type annotations. (#281 <>_)
    • ๐Ÿ”ฆ Expose all error classes in the cattr.errors namespace. Note that it is deprecated, just use cattrs.errors. (#252 <>_)
    • ๐Ÿ›  Fix generating structuring functions for types with quotes in the name. (#291 <>_ #277 <>_)
    • ๐Ÿ›  Fix usage of notes for the final version of PEP 678 <>, supported since exceptiongroup>=1.0.0rc4. (#303 <303 <>)

Previous changes from v22.1.0

    • cattrs now uses the CalVer versioning convention.
    • โœ… cattrs now has a detailed validation mode, which is enabled by default. Learn more here <>_. The old behavior can be restored by creating the converter with detailed_validation=False.
    • attrs and dataclass structuring is now ~25% faster.
    • ๐Ÿ›  Fix an issue structuring bare typing.List s on Pythons lower than 3.9. (#209 <>_)
    • ๐Ÿ›  Fix structuring of non-parametrized containers like list/dict/... on Pythons lower than 3.9. (#218 <>_)
    • ๐Ÿ›  Fix structuring bare typing.Tuple on Pythons lower than 3.9. (#218 <>_)
    • Fix a wrong AttributeError of an missing __parameters__ attribute. This could happen when inheriting certain generic classes โ€“ for example typing.* classes are affected. (#217 <>_)
    • ๐Ÿ›  Fix structuring of enum.Enum instances in typing.Literal types. (#231 <>_)
    • ๐Ÿ›  Fix unstructuring all tuples - unannotated, variable-length, homogenous and heterogenous - to list. (#226 <>_)
    • For forbid_extra_keys raise custom ForbiddenExtraKeyError instead of generic Exception. (#225 <>_)
    • ๐Ÿ‘€ All preconf converters now support loads and dumps directly. See an example here <>_.
    • ๐Ÿ›  Fix mappings with byte keys for the orjson, bson and tomlkit converters. (#241 <>_)