All Versions
27
Latest Version
Avg Release Cycle
83 days
Latest Release
125 days ago

Changelog History
Page 1

  • v22.2.0 Changes

    October 03, 2022
    • 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 <https://docs.python.org/3/library/typing.html#newtype>_ are now supported by the cattrs.Converter. (#255 <https://github.com/python-attrs/cattrs/pull/255>, #94 <https://github.com/python-attrs/cattrs/issues/94>, #297 <https://github.com/python-attrs/cattrs/issues/297>_)
    • cattrs.Converter and cattrs.BaseConverter can now copy themselves using the copy method. (#284 <https://github.com/python-attrs/cattrs/pull/284>_)
    • ๐Ÿ‘ Python 3.11 support.
    • ๐Ÿ‘ cattrs now supports un/structuring kw_only fields on attrs classes into/from dictionaries. (#247 <https://github.com/python-attrs/cattrs/pull/247>_)
    • โช PyPy support (and tests, using a minimal Hypothesis profile) restored. (#253 <https://github.com/python-attrs/cattrs/issues/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 <https://github.com/python-attrs/cattrs/issues/264>_)
    • ๐Ÿ“Œ Uncap the required Python version, to avoid problems detailed in https://iscinumpy.dev/post/bound-version-constraints/#pinning-the-python-version-is-special (#275 <https://github.com/python-attrs/cattrs/issues/275>_)
    • Fix Converter.register_structure_hook_factory and cattrs.gen.make_dict_unstructure_fn type annotations. (#281 <https://github.com/python-attrs/cattrs/issues/281>_)
    • ๐Ÿ”ฆ Expose all error classes in the cattr.errors namespace. Note that it is deprecated, just use cattrs.errors. (#252 <https://github.com/python-attrs/cattrs/issues/252>_)
    • ๐Ÿ›  Fix generating structuring functions for types with quotes in the name. (#291 <https://github.com/python-attrs/cattrs/issues/291>_ #277 <https://github.com/python-attrs/cattrs/issues/277>_)
    • ๐Ÿ›  Fix usage of notes for the final version of PEP 678 <https://peps.python.org/pep-0678/>, supported since exceptiongroup>=1.0.0rc4. (#303 <303 <https://github.com/python-attrs/cattrs/pull/303>)
  • v22.1.0 Changes

    April 03, 2022
    • cattrs now uses the CalVer versioning convention.
    • โœ… cattrs now has a detailed validation mode, which is enabled by default. Learn more here <https://cattrs.readthedocs.io/en/latest/validation.html>_. 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 <https://github.com/python-attrs/cattrs/issues/209>_)
    • ๐Ÿ›  Fix structuring of non-parametrized containers like list/dict/... on Pythons lower than 3.9. (#218 <https://github.com/python-attrs/cattrs/issues/218>_)
    • ๐Ÿ›  Fix structuring bare typing.Tuple on Pythons lower than 3.9. (#218 <https://github.com/python-attrs/cattrs/issues/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 <https://github.com/python-attrs/cattrs/issues/217>_)
    • ๐Ÿ›  Fix structuring of enum.Enum instances in typing.Literal types. (#231 <https://github.com/python-attrs/cattrs/pull/231>_)
    • ๐Ÿ›  Fix unstructuring all tuples - unannotated, variable-length, homogenous and heterogenous - to list. (#226 <https://github.com/python-attrs/cattrs/issues/226>_)
    • For forbid_extra_keys raise custom ForbiddenExtraKeyError instead of generic Exception. (#225 <https://github.com/python-attrs/cattrs/pull/225>_)
    • ๐Ÿ‘€ All preconf converters now support loads and dumps directly. See an example here <https://cattrs.readthedocs.io/en/latest/preconf.html>_.
    • ๐Ÿ›  Fix mappings with byte keys for the orjson, bson and tomlkit converters. (#241 <https://github.com/python-attrs/cattrs/issues/241>_)
  • v1.10.0 Changes

    January 04, 2022
    • โž• Add PEP 563 (string annotations) support for dataclasses. (#195 <https://github.com/python-attrs/cattrs/issues/195>_)
    • ๐Ÿ›  Fix handling of dictionaries with string Enum keys for bson, orjson, and tomlkit.
    • Rename the cattr.gen.make_dict_unstructure_fn.omit_if_default parameter to _cattrs_omit_if_default, for consistency. The omit_if_default parameters to GenConverter and override are unchanged.
    • ๐Ÿ“ฆ Following the changes in attrs 21.3.0, add a cattrs package mirroring the existing cattr package. Both package names may be used as desired, and the cattr package isn't going away.
  • v1.9.0 Changes

    December 06, 2021
    • ๐Ÿ‘ Python 3.10 support, including support for the new union syntax (A | B vs Union[A, B]).
    • The GenConverter can now properly structure generic classes with generic collection fields. (#149 <https://github.com/python-attrs/cattrs/issues/149>_)
    • omit=True now also affects generated structuring functions. (#166 <https://github.com/python-attrs/cattrs/issues/166>_)
    • cattr.gen.{make_dict_structure_fn, make_dict_unstructure_fn} now resolve type annotations automatically when PEP 563 is used. (#169 <https://github.com/python-attrs/cattrs/issues/169>_)
    • Protocols are now unstructured as their runtime types. (#177 <https://github.com/python-attrs/cattrs/pull/177>_)
    • Fix an issue generating structuring functions with renaming and _cattrs_forbid_extra_keys=True. (#190 <https://github.com/python-attrs/cattrs/issues/190>_)
  • v1.8.0 Changes

    August 13, 2021
    • ๐Ÿ›  Fix GenConverter mapping structuring for unannotated dicts on Python 3.8. (#151 <https://github.com/python-attrs/cattrs/issues/151>_)
    • The source code for generated un/structuring functions is stored in the linecache cache, which enables more informative stack traces when un/structuring errors happen using the GenConverter. This behavior can optionally be disabled to save memory.
    • ๐Ÿ‘Œ Support using the attr converter callback during structure. By default, this is a method of last resort, but it can be elevated to the default by setting prefer_attrib_converters=True on Converter or GenConverter. (#138 <https://github.com/python-attrs/cattrs/issues/138>_)
    • ๐Ÿ›  Fix structuring recursive classes. (#159 <https://github.com/python-attrs/cattrs/issues/159>_)
    • ๐Ÿ‘ Converters now support un/structuring hook factories. This is the most powerful and complex venue for customizing un/structuring. This had previously been an internal feature.
    • ๐Ÿ“š The Common Usage Examples <https://cattrs.readthedocs.io/en/latest/usage.html#using-factory-hooks>_ documentation page now has a section on advanced hook factory usage.
    • ๐Ÿ‘ cattr.override now supports the omit parameter, which makes cattrs skip the atribute entirely when unstructuring.
    • ๐Ÿ“ฆ The cattr.preconf.bson module is now tested against the bson module bundled with the pymongo package, because that package is much more popular than the standalone PyPI bson package.
  • v1.7.1 Changes

    May 28, 2021
    • ๐Ÿ‘ Literal s are not supported on Python 3.9.0 (supported on 3.9.1 and later), so we skip importing them there. (#150 <https://github.com/python-attrs/cattrs/issues/150>_)
  • v1.7.0 Changes

    May 26, 2021
    • cattr.global_converter (which provides cattr.unstructure, cattr.structure etc.) is now an instance of cattr.GenConverter.
    • ๐Ÿ‘ Literal s are now supported and validated when structuring.
    • ๐Ÿ›  Fix dependency metadata information for attrs. (#147 <https://github.com/python-attrs/cattrs/issues/147>_)
    • ๐Ÿ›  Fix GenConverter mapping structuring for unannotated dicts. (#148 <https://github.com/python-attrs/cattrs/issues/148>_)
  • v1.6.0 Changes

    April 28, 2021
    • cattrs now uses Poetry.
    • GenConverter mapping structuring is now ~25% faster, and unstructuring heterogenous tuples is significantly faster.
    • โž• Add cattr.preconf. This package contains modules for making converters for particular serialization libraries. We currently support the standard library json, and third-party ujson, orjson, msgpack, bson, pyyaml and tomlkit libraries.
  • v1.5.0 Changes

    April 15, 2021
    • ๐Ÿ›  Fix an issue with GenConverter unstructuring attrs classes and dataclasses with generic fields. (#65 <https://github.com/python-attrs/cattrs/issues/65>_)
    • GenConverter has support for easy overriding of collection unstructuring types (for example, unstructure all sets to lists) through its unstruct_collection_overrides argument. (#137 <https://github.com/python-attrs/cattrs/pull/137>_)
    • Unstructuring mappings with GenConverter is significantly faster.
    • GenConverter supports strict handling of unexpected dictionary keys through its forbid_extra_keys argument. (#142 <https://github.com/python-attrs/cattrs/pull/142>_)
  • v1.4.0 Changes

    March 21, 2021
    • ๐Ÿ›  Fix an issue with GenConverter un/structuring hooks when a function hook is registered after the converter has already been used.
    • โž• Add support for collections.abc.{Sequence, MutableSequence, Set, MutableSet}. These should be used on 3.9+ instead of their typing alternatives, which are deprecated. (#128 <https://github.com/python-attrs/cattrs/issues/128>_)
    • The GenConverter will unstructure iterables (list[T], tuple[T, ...], set[T]) using their type argument instead of the runtime class if its elements, if possible. These unstructuring operations are up to 40% faster. (#129 <https://github.com/python-attrs/cattrs/issues/129>_)
    • Flesh out Converter and GenConverter initializer type annotations. (#131 <https://github.com/python-attrs/cattrs/issues/131>_)
    • โž• Add support for typing.Annotated on Python 3.9+. cattrs will use the first annotation present. cattrs specific annotations may be added in the future. (#127 <https://github.com/python-attrs/cattrs/issues/127>_)
    • โž• Add support for dataclasses. (#43 <https://github.com/python-attrs/cattrs/issues/43>_)