Skip to content

v25.1.0

Latest
Compare
Choose a tag to compare
@Tinche Tinche released this 31 May 09:57
· 1 commit to main since this release
  • Potentially breaking: The converters raise StructureHandlerNotFoundError more eagerly (on hook creation, instead of on hook use). This helps surfacing problems with missing hooks sooner. See Migrations for steps to restore legacy behavior.
    (#577)
  • Add a Migrations page, with instructions on migrating changed behavior for each version.
    (#577)
  • typing.Self is now supported in attrs classes, dataclasses, TypedDicts and the dict NamedTuple factories. See typing.Self for details.
    (#299 #627)
  • PEP 695 type aliases can now be used with BaseConverter.register_structure_hook and BaseConverter.register_unstructure_hook. Previously, they required the use of BaseConverter.register_structure_hook_func (which is still supported).
    (#647)
  • Expose cattrs.cols.mapping_unstructure_factory through cattrs.cols.
  • Some defaultdicts are now supported by default, and
    cattrs.cols.is_defaultdict and cattrs.cols.defaultdict_structure_factory are exposed through cattrs.cols.
    (#519 #588)
  • Generic PEP 695 type aliases are now supported.
    (#611 #618)
  • The tagged union strategy now also supports type aliases of unions.
    (#649)
  • Converter.copy and BaseConverter.copy are correctly annotated as returning Self.
    (#644)
  • Many preconf converters (bson, stdlib JSON, cbor2, msgpack, msgspec, orjson, ujson) skip unstructuring int and str enums, leaving them to the underlying libraries to handle with greater efficiency.
    (#598)
  • The msgspec JSON preconf converter now handles dataclasses with private attributes more efficiently.
    (#624)
  • Literals containing enums are now unstructured properly, and their unstructuring is greatly optimized in the bson, stdlib JSON, cbor2, msgpack, msgspec, orjson and ujson preconf converters.
    (#598)
  • Preconf converters now handle dictionaries with literal keys properly.
    (#599)
  • Structuring TypedDicts from invalid inputs now properly raises a ClassValidationError.
    (#615 #616)
  • cattrs.strategies.include_subclasses now properly works with generic parent classes.
    (#649)
  • Replace cattrs.gen.MappingStructureFn with cattrs.SimpleStructureHook.
  • Python 3.13 is now supported.
    (#543 #547)
  • Python 3.8 is no longer supported, as it is end-of-life. Use previous versions on this Python version.
    (#591)
  • Change type of Converter.__init__.unstruct_collection_overrides from Callable to Mapping[type, UnstructureHook]
    (#594).
  • Adopt the Contributor Covenant Code of Conduct (just like attrs).