Cattrs

Latest version: v24.1.3

Safety actively analyzes 723296 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

1.7.0

- `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))

1.6.0

- _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.

1.5.0

- 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))

1.4.0

- 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))

1.3.0

- _cattrs_ now has a benchmark suite to help make and keep cattrs the fastest it can be. The instructions on using it can be found under the [Benchmarking](https://cattrs.readthedocs.io/en/latest/benchmarking.html) section in the docs.
([123](https://github.com/python-attrs/cattrs/pull/123))
- Fix an issue unstructuring tuples of non-primitives.
([125](https://github.com/python-attrs/cattrs/issues/125))
- _cattrs_ now calls `attr.resolve_types` on _attrs_ classes when registering un/structuring hooks.
- `GenConverter` structuring and unstructuring of _attrs_ classes is significantly faster.

1.2.0

- `converter.unstructure` now supports an optional parameter, `unstructure_as`, which can be used to unstructure something as a different type. Useful for unions.
- Improve support for union un/structuring hooks. Flesh out docs for advanced union handling.
([115](https://github.com/python-attrs/cattrs/pull/115))
- Fix `GenConverter` behavior with inheritance hierarchies of _attrs_ classes.
([117](https://github.com/python-attrs/cattrs/pull/117 [#116](https://github.com/python-attrs/cattrs/issues/116>))
- Refactor `GenConverter.un/structure_attrs_fromdict` into `GenConverter.gen_un/structure_attrs_fromdict` to allow calling back to `Converter.un/structure_attrs_fromdict` without sideeffects.
([118](https://github.com/python-attrs/cattrs/issues/118))

Page 4 of 7

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.