Skip to content

Commit b22195e

Browse files
committed
Prepare 21.1.0
1 parent c5ae43f commit b22195e

21 files changed

+78
-58
lines changed

CHANGELOG.rst

+77-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,87 @@ Changelog
44
Versions follow `CalVer <https://calver.org>`_ with a strict backwards compatibility policy.
55
The third digit is only for regressions.
66

7-
Changes for the upcoming release can be found in the `"changelog.d" directory <https://github.com/python-attrs/attrs/tree/main/changelog.d>`_ in our repository.
7+
.. towncrier release notes start
88
9-
..
10-
Do *NOT* add changelog entries here!
9+
21.1.0 (2021-05-06)
10+
-------------------
1111

12-
This changelog is managed by towncrier and is compiled at release time.
12+
Deprecations
13+
^^^^^^^^^^^^
1314

14-
See https://www.attrs.org/en/latest/contributing.html#changelog for details.
15+
- The long-awaited, much-talked-about, little-delivered ``import attrs`` is finally upon us!
16+
17+
Since the NG APIs have now been proclaimed stable, the **next** release of ``attrs`` will allow you to actually ``import attrs``.
18+
We're taking this opportunity to replace some defaults in our APIs that made sense in 2015, but don't in 2021.
19+
20+
So please, if you have any pet peeves about defaults in ``attrs``'s APIs, *now* is the time to air your grievances in #487!
21+
We're not gonna get such a chance for a second time, without breaking our backward-compatibility guarantees, or long deprecation cycles.
22+
Therefore, speak now or forever hold you peace!
23+
`#487 <https://github.com/python-attrs/attrs/issues/487>`_
24+
- The *cmp* argument to ``attr.s()`` and `attr.ib()` has been **undeprecated**
25+
It will continue to be supported as syntactic sugar to set *eq* and *order* in one go.
26+
27+
I'm terribly sorry for the hassle around this argument!
28+
The reason we're bringing it back is it's usefulness regarding customization of equality/ordering.
29+
30+
The ``cmp`` attribute and argument on ``attr.Attribute`` remains deprecated and will be removed later this year.
31+
`#773 <https://github.com/python-attrs/attrs/issues/773>`_
32+
33+
34+
Changes
35+
^^^^^^^
36+
37+
- It's now possible to customize the behavior of ``eq`` and ``order`` by passing in a callable.
38+
`#435 <https://github.com/python-attrs/attrs/issues/435>`_,
39+
`#627 <https://github.com/python-attrs/attrs/issues/627>`_
40+
- The instant favorite `next-generation APIs <https://www.attrs.org/en/stable/api.html#next-gen>`_ are not provisional anymore!
41+
42+
They are also officially supported by Mypy as of their `0.800 release <https://mypy-lang.blogspot.com/2021/01/mypy-0800-released.html>`_.
43+
44+
We hope the next release will already contain an (additional) importable package called ``attrs``.
45+
`#668 <https://github.com/python-attrs/attrs/issues/668>`_,
46+
`#786 <https://github.com/python-attrs/attrs/issues/786>`_
47+
- If an attribute defines a converter, the type of its parameter is used as type annotation for its corresponding ``__init__`` parameter.
48+
49+
If an ``attr.converters.pipe`` is used, the first one's is used.
50+
`#710 <https://github.com/python-attrs/attrs/issues/710>`_
51+
- Fixed the creation of an extra slot for an ``attr.ib`` when the parent class already has a slot with the same name.
52+
`#718 <https://github.com/python-attrs/attrs/issues/718>`_
53+
- ``__attrs__init__()`` will now be injected if ``init=False``, or if ``auto_detect=True`` and a user-defined ``__init__()`` exists.
54+
55+
This enables users to do "pre-init" work in their ``__init__()`` (such as ``super().__init__()``).
56+
57+
``__init__()`` can then delegate constructor argument processing to ``self.__attrs_init__(*args, **kwargs)``.
58+
`#731 <https://github.com/python-attrs/attrs/issues/731>`_
59+
- ``bool(attr.NOTHING)`` is now ``False``.
60+
`#732 <https://github.com/python-attrs/attrs/issues/732>`_
61+
- It's now possible to use ``super()`` inside of properties of slotted classes.
62+
`#747 <https://github.com/python-attrs/attrs/issues/747>`_
63+
- Allow for a ``__attrs_pre_init__()`` method that -- if defined -- will get called at the beginning of the ``attrs``-generated ``__init__()`` method.
64+
`#750 <https://github.com/python-attrs/attrs/issues/750>`_
65+
- Added forgotten ``attr.Attribute.evolve()`` to type stubs.
66+
`#752 <https://github.com/python-attrs/attrs/issues/752>`_
67+
- ``attrs.evolve()`` now works recursively with nested ``attrs`` classes.
68+
`#759 <https://github.com/python-attrs/attrs/issues/759>`_
69+
- Python 3.10 is now officially supported.
70+
`#763 <https://github.com/python-attrs/attrs/issues/763>`_
71+
- ``attr.resolve_types()`` now takes an optional *attrib* argument to work inside a ``field_transformer``.
72+
`#774 <https://github.com/python-attrs/attrs/issues/774>`_
73+
- ``ClassVar``\ s are now also detected if they come from `typing-extensions <https://pypi.org/project/typing-extensions/>`_.
74+
`#782 <https://github.com/python-attrs/attrs/issues/782>`_
75+
- To make it easier to customize attribute comparison (#435), we have added the ``attr.cmp_with()`` helper.
76+
77+
See the `new docs on comparison <https://www.attrs.org/en/stable/comparison.html>`_ for more details.
78+
`#787 <https://github.com/python-attrs/attrs/issues/787>`_
79+
- Added **provisional** support for static typing in ``pyright`` via the `dataclass_transforms specification <https://github.com/microsoft/pyright/blob/master/specs/dataclass_transforms.md>`_.
80+
Both the ``pyright`` specification and ``attrs`` implementation may change in future versions of both projects.
81+
82+
Your constructive feedback is welcome in both `attrs#795 <https://github.com/python-attrs/attrs/issues/795>`_ and `pyright#1782 <https://github.com/microsoft/pyright/discussions/1782>`_.
83+
`#796 <https://github.com/python-attrs/attrs/issues/796>`_
84+
85+
86+
----
1587

16-
.. towncrier release notes start
1788

1889
20.3.0 (2020-11-05)
1990
-------------------

changelog.d/435.change.rst

-1
This file was deleted.

changelog.d/487.deprecation.rst

-8
This file was deleted.

changelog.d/627.change.rst

-1
This file was deleted.

changelog.d/668.change.rst

-5
This file was deleted.

changelog.d/710.change.rst

-3
This file was deleted.

changelog.d/718.change.rst

-1
This file was deleted.

changelog.d/731.change.rst

-5
This file was deleted.

changelog.d/732.change.rst

-1
This file was deleted.

changelog.d/747.change.rst

-1
This file was deleted.

changelog.d/750.change.rst

-1
This file was deleted.

changelog.d/752.change.rst

-1
This file was deleted.

changelog.d/759.change.rst

-1
This file was deleted.

changelog.d/763.change.rst

-1
This file was deleted.

changelog.d/773.deprecation.rst

-7
This file was deleted.

changelog.d/774.change.rst

-1
This file was deleted.

changelog.d/782.change.rst

-1
This file was deleted.

changelog.d/786.change.rst

-5
This file was deleted.

changelog.d/787.change.rst

-3
This file was deleted.

changelog.d/796.change.rst

-4
This file was deleted.

src/attr/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from ._version_info import VersionInfo
2323

2424

25-
__version__ = "21.1.0.dev0"
25+
__version__ = "21.1.0"
2626
__version_info__ = VersionInfo._from_version_string(__version__)
2727

2828
__title__ = "attrs"

0 commit comments

Comments
 (0)