I’m happy to announce the release of attrs 20.3.0!
attrs is the direct ancestor – and the inspiration for – dataclasses in the standard library and remains the more powerful option for creating regular classes without getting bogged down with writing identical boilerplate again and again: https://www.attrs.org/
Heartfelt thanks to my generous sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-attrs, and people who bought me a coffee on https://ko-fi.com/the_hynek! Support like that makes me merge PRs and release software on a Saturday afternoon! <3
The main features of this release are:
- Field transformers! We now offer an official way to hook into the creation of fields/attributes and allow you to modify or even drop them: https://www.attrs.org/en/stable/extending.html#automatic-field-transformation-and-modification. This should allow more exciting things to be built in the future and be another tool for people building higher-level toolkits on top of attrs.
- If you clicked that link you’ve already noticed: attrs is now using the beautiful Sphinx theme “furo” by Pradyun Gedam. You can check it out at https://github.com/pradyunsg/furo. YOUR docs can look good too!
All Changes: ============
- attr.define(), attr.frozen(), attr.mutable(), and attr.field() remain provisional.
This release does not change change anything about them and they are already used widely in production though.
If you wish to use them together with mypy, you can simply drop this plugin into your project.
Feel free to provide feedback to them in the linked issue #668.
We will release the attrs namespace once we have the feeling that the APIs have properly settled. #668
- attr.s() now has a field_transformer hook that is called for all Attributes and returns a (modified or updated) list of Attribute instances. attr.asdict() has a value_serializer hook that can change the way values are converted. Both hooks are meant to help with data (de-)serialization workflows. #653 - kw_only=True now works on Python 2. #700 - raise from now works on frozen classes on PyPy. #703, #712 - attr.asdict() and attr.astuple() now treat frozensets like sets with regards to the retain_collection_types argument. #704 - The type stubs for attr.s() and attr.make_class() are not missing the collect_by_mro argument anymore. #711