# attrs 23.2.0 - Product: attrs (https://whatsnew.fyi/product/attrs) - Vendor: attrs - Date: 2023-12-31 - Version: 23.2.0 - Original notes: https://github.com/python-attrs/attrs/releases/tag/23.2.0 - Permalink: https://whatsnew.fyi/product/attrs/releases/23.2.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: release facts (products, versions, dates, links, CVE ids and flags) are open data under CC BY 4.0, from the API at https://whatsnew.fyi/api/v1 or the nightly dataset at https://github.com/whatsnew-fyi/dataset. The summaries, labels and curation are © What's New: quote freely with attribution and a link back; wholesale republication of them is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- Changes to check: - **Behavior changed:** `__attrs_pre_init__` (inferred by a model) - **fixed** — The type annotation for attrs.resolve_types() is now correct - **changed** — Type stubs now use typing.dataclass_transform to decorate dataclass-like decorators instead of the non-standard __dataclass_transform__ special form - **fixed** — Fixed serialization of namedtuple fields using attrs.asdict/astuple() with retain_collection_types=True - **changed** — attrs.AttrsInstance is now a typing.Protocol in both type hints and code, allowing you to subclass it along with another Protocol - **changed** — If attrs detects that __attrs_pre_init__ accepts more than just self, it will call it with the same arguments as __init__ was called - **added** — Slotted classes now transform functools.cached_property decorated methods to support equivalent semantics - **added** — Added class_body argument to attrs.make_class() to provide additional attributes for newly created classes ##### Highlights Mostly typing fixes in this release, but I'm excited that we found a workaround to make `functools.cached_property` work with slotted classes! Also, I'm sure there's gonna be fans of the new behavior of `__attrs_pre_init__` where it receives all arguments passed to `__init__` if it accepts more than `self`. *Full changelog below!* ##### Special Thanks This release would not be possible without my generous sponsors! Thank you to all of you making sustainable maintenance possible! If *you* would like to join them, go to and check out the sweet perks! ###### Above and Beyond [Variomedia AG](https://www.variomedia.de/) (@[variomedia](https://github.com/variomedia)), [Tidelift](https://www.tidelift.com/) (@[tidelift](https://github.com/tidelift)), [FilePreviews](http://filepreviews.io/) (@[filepreviews](https://github.com/filepreviews)), Daniel Fortunov (@[asqui](https://github.com/asqui)), and Kevin P. Fleming (@[kpfleming](https://github.com/kpfleming)). ###### Maintenance Sustainers [Adam Hill](https://adamghill.com) (@[adamghill](https://github.com/adamghill)), Dan Groshev (@[si14](https://github.com/si14)), Magnus Watn (@[magnuswatn](https://github.com/magnuswatn)), [David Cramer](http://cra.mr) (@[dcramer](https://github.com/dcramer)), Moving Content AG (@[moving-content](https://github.com/moving-content)), [ProteinQure](https://proteinqure.com/) (@[ProteinQure](https://github.com/ProteinQure)), Jesse Snyder (@[jessesnyder](https://github.com/jessesnyder)), [Rivo Laks](https://rivolaks.com) (@[rivol](https://github.com/rivol)), [Ionel Cristian Mărieș](https://blog.ionelmc.ro) (@[ionelmc](https://github.com/ionelmc)), [The Westervelt Company](https://westervelt.com) (@[westerveltco](https://github.com/westerveltco)), Philippe Galvan (@[PhilippeGalvan](https://github.com/PhilippeGalvan)), [Birk Jernström](polar.sh) (@[birkjernstrom](https://github.com/birkjernstrom)), [Tim Schilling](www.better-simple.com) (@[tim-schilling](https://github.com/tim-schilling)), Chris Withers (@[cjw296](https://github.com/cjw296)), [Christopher Dignam](https://christopher.xyz) (@[chdsbd](https://github.com/chdsbd)), [Stefan Hagen](https://stefan-hagen.website) (@[sthagen](https://github.com/sthagen)), [Sławomir Ehlert](slafs.net) (@[slafs](https://github.com/slafs)), Mostafa Khalil (@[khadrawy](https://github.com/khadrawy)), [Filip Mularczyk](fmularczyk.pl) (@[mukiblejlok](https://github.com/mukiblejlok)), and [Mike Fiedler](https://mike.fiedler.me) (@[miketheman](https://github.com/miketheman)). Not to forget 6 more amazing humans who chose to be generous but anonymous! ##### Full Changelog ###### Changes - The type annotation for `attrs.resolve_types()` is now correct. [\#1141](https://github.com/python-attrs/attrs/issues/1141) - Type stubs now use `typing.dataclass_transform` to decorate dataclass-like decorators, instead of the non-standard `__dataclass_transform__` special form, which is only supported by Pyright. [\#1158](https://github.com/python-attrs/attrs/issues/1158) - Fixed serialization of namedtuple fields using `attrs.asdict/astuple()` with `retain_collection_types=True`. [\#1165](https://github.com/python-attrs/attrs/issues/1165) - `attrs.AttrsInstance` is now a `typing.Protocol` in both type hints and code. This allows you to subclass it along with another `Protocol`. [\#1172](https://github.com/python-attrs/attrs/issues/1172) - If *attrs* detects that `__attrs_pre_init__` accepts more than just `self`, it will call it with the same arguments as `__init__` was called. This allows you to, for example, pass arguments to `super().__init__()`. [\#1187](https://github.com/python-attrs/attrs/issues/1187) - Slotted classes now transform `functools.cached_property` decorated methods to support equivalent semantics. [\#1200](https://github.com/python-attrs/attrs/issues/1200) - Added *class_body* argument to `attrs.make_class()` to provide _[Truncated at 4000 characters — full notes: https://github.com/python-attrs/attrs/releases/tag/23.2.0]_