Skip to content

Commit dd26edd

Browse files
committed
Prepare 21.3.0
1 parent 20bf4b6 commit dd26edd

18 files changed

+67
-49
lines changed

CHANGELOG.rst

+66-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,76 @@ Whenever there is a need to break compatibility, it is announced here in the cha
1717

1818
However if you intend to build extensions on top of ``attrs`` you have to anticipate that.
1919

20-
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.
20+
.. towncrier release notes start
2121
22-
..
23-
Do *NOT* add changelog entries here!
22+
21.3.0 (2021-12-28)
23+
-------------------
2424

25-
This changelog is managed by towncrier and is compiled at release time.
25+
Backward-incompatible Changes
26+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2627

27-
See https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md#changelog for details.
28+
- When using ``@define``, converters are now run by default when setting an attribute on an instance -- additionally to validators.
29+
I.e. the new default is ``on_setattr=[attrs.setters.convert, attrs.setters.validate]``.
30+
31+
This is unfortunately a breaking change, but it was an oversight, impossible to raise a ``DeprecationWarning`` about, and it's better to fix it now while the APIs are very fresh with few users.
32+
`#835 <https://github.com/python-attrs/attrs/issues/835>`_,
33+
`#886 <https://github.com/python-attrs/attrs/issues/886>`_
34+
- ``import attrs`` has finally landed!
35+
As of this release, you can finally import ``attrs`` using its proper name.
36+
37+
Not all names from the ``attr`` namespace have been transferred; most notably ``attr.s`` and ``attr.ib`` are missing.
38+
See ``attrs.define`` and ``attrs.field`` if you haven't seen our next-generation APIs yet.
39+
A more elaborate explanation can be found `On The Core API Names <https://www.attrs.org/en/latest/names.html>`_
40+
41+
This feature is at least for one release **provisional**.
42+
We don't *plan* on changing anything, but such a big change is unlikely to go perfectly on the first strike.
43+
44+
The API docs have been mostly updated, but it will be an ongoing effort to change everything to the new APIs.
45+
Please note that we have **not** moved -- or even removed -- anything from ``attr``!
46+
47+
Please do report any bugs or documentation inconsistencies!
48+
`#887 <https://github.com/python-attrs/attrs/issues/887>`_
49+
50+
51+
Changes
52+
^^^^^^^
53+
54+
- ``attr.asdict(retain_collection_types=False)`` (default) dumps collection-esque keys as tuples.
55+
`#646 <https://github.com/python-attrs/attrs/issues/646>`_,
56+
`#888 <https://github.com/python-attrs/attrs/issues/888>`_
57+
- ``__match_args__`` are now generated to support Python 3.10's
58+
`Structural Pattern Matching <https://docs.python.org/3.10/whatsnew/3.10.html#pep-634-structural-pattern-matching>`_.
59+
This can be controlled by the ``match_args`` argument to the class decorators on Python 3.10 and later.
60+
On older versions, it is never added and the argument is ignored.
61+
`#815 <https://github.com/python-attrs/attrs/issues/815>`_
62+
- If the class-level *on_setattr* is set to ``attrs.setters.validate`` (default in ``@define`` and ``@mutable``) but no field defines a validator, pretend that it's not set.
63+
`#817 <https://github.com/python-attrs/attrs/issues/817>`_
64+
- The generated ``__repr__`` is significantly faster on Pythons with f-strings.
65+
`#819 <https://github.com/python-attrs/attrs/issues/819>`_
66+
- Attributes transformed via ``field_transformer`` are wrapped with ``AttrsClass`` again.
67+
`#824 <https://github.com/python-attrs/attrs/issues/824>`_
68+
- Generated source code is now cached more efficiently for identical classes.
69+
`#828 <https://github.com/python-attrs/attrs/issues/828>`_
70+
- Added ``attrs.converters.to_bool()``.
71+
`#830 <https://github.com/python-attrs/attrs/issues/830>`_
72+
- ``attrs.resolve_types()`` now resolves types of subclasses after the parents are resolved.
73+
`#842 <https://github.com/python-attrs/attrs/issues/842>`_
74+
`#843 <https://github.com/python-attrs/attrs/issues/843>`_
75+
- Added new validators: ``lt(val)`` (< val), ``le(va)`` (≤ val), ``ge(val)`` (≥ val), ``gt(val)`` (> val), and ``maxlen(n)``.
76+
`#845 <https://github.com/python-attrs/attrs/issues/845>`_
77+
- ``attrs`` classes are now fully compatible with `cloudpickle <https://github.com/cloudpipe/cloudpickle>`_ (no need to disable ``repr`` anymore).
78+
`#857 <https://github.com/python-attrs/attrs/issues/857>`_
79+
- Added new context manager ``attrs.validators.disabled()`` and functions ``attrs.validators.(set|get)_disabled()``.
80+
They deprecate ``attrs.(set|get)_run_validators()``.
81+
All functions are interoperable and modify the same internal state.
82+
They are not – and never were – thread-safe, though.
83+
`#859 <https://github.com/python-attrs/attrs/issues/859>`_
84+
- ``attrs.validators.matches_re()`` now accepts pre-compiled regular expressions in addition to pattern strings.
85+
`#877 <https://github.com/python-attrs/attrs/issues/877>`_
86+
87+
88+
----
2889

29-
.. towncrier release notes start
3090

3191
21.2.0 (2021-05-07)
3292
-------------------

changelog.d/646.change.rst

-1
This file was deleted.

changelog.d/815.change.rst

-4
This file was deleted.

changelog.d/817.change.rst

-1
This file was deleted.

changelog.d/819.change.rst

-1
This file was deleted.

changelog.d/824.change.rst

-1
This file was deleted.

changelog.d/828.change.rst

-1
This file was deleted.

changelog.d/830.change.rst

-1
This file was deleted.

changelog.d/835.breaking.rst

-4
This file was deleted.

changelog.d/843.change.rst

-2
This file was deleted.

changelog.d/845.change.rst

-1
This file was deleted.

changelog.d/857.change.rst

-1
This file was deleted.

changelog.d/859.change.rst

-4
This file was deleted.

changelog.d/877.change.rst

-1
This file was deleted.

changelog.d/886.breaking.rst

-4
This file was deleted.

changelog.d/887.breaking.rst

-14
This file was deleted.

changelog.d/888.change.rst

-1
This file was deleted.

src/attr/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from ._version_info import VersionInfo
2525

2626

27-
__version__ = "21.3.0.dev0"
27+
__version__ = "21.3.0"
2828
__version_info__ = VersionInfo._from_version_string(__version__)
2929

3030
__title__ = "attrs"

0 commit comments

Comments
 (0)