• [Python-announce] attrs 23.2.0

    From Hynek Schlawack@21:1/5 to All on Sun Dec 31 07:32:48 2023
    I’m happy to announce a new release of attrs!

    attrs is the direct ancestor of – and the inspiration for – dataclasses in the standard library and remains the more powerful toolkit for creating regular classes without getting bogged down with writing repetitive boilerplate code: <https://www.
    attrs.org/>

    ------------------------------------------------------------------------

    (alternatively, see <https://github.com/python-attrs/attrs/releases/> for a richer-formatted version of the following)

    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.

    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 https://github.com/sponsors/hynek and check out the sweet perks!

    Above and Beyond

    Variomedia AG (@variomedia), Tidelift (@tidelift), FilePreviews (@filepreviews), Daniel Fortunov (@asqui), and Kevin P. Fleming (@kpfleming).

    Maintenance Sustainers

    Adam Hill (@adamghill), Dan Groshev (@si14), Magnus Watn (@magnuswatn), David Cramer (@dcramer), Moving Content AG (@moving-content), ProteinQure (@ProteinQure), Jesse Snyder (@jessesnyder), Rivo Laks (@rivol), Ionel Cristian Mărieș (@ionelmc), The
    Westervelt Company (@westerveltco), Philippe Galvan (@PhilippeGalvan), Birk Jernström (@birkjernstrom), Tim Schilling (@tim-schilling), Chris Withers (@cjw296), Christopher Dignam (@chdsbd), Stefan Hagen (@sthagen), Sławomir Ehlert (@slafs), Mostafa
    Khalil (@khadrawy), Filip Mularczyk (@mukiblejlok), and Mike Fiedler (@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
    - 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
    - Fixed serialization of namedtuple fields using attrs.asdict/astuple() with retain_collection_types=True. #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
    - 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
    - Slotted classes now transform functools.cached_property decorated methods to support equivalent semantics. #1200
    - Added class_body argument to attrs.make_class() to provide additional attributes for newly created classes. It is, for example, now possible to attach methods. #1203

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)