Skip to content

Commit

Permalink
Prepare 21.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Dec 28, 2021
1 parent 20bf4b6 commit dd26edd
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 49 deletions.
72 changes: 66 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,76 @@ Whenever there is a need to break compatibility, it is announced here in the cha

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

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

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

See https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md#changelog for details.
- When using ``@define``, converters are now run by default when setting an attribute on an instance -- additionally to validators.
I.e. the new default is ``on_setattr=[attrs.setters.convert, attrs.setters.validate]``.

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.
`#835 <https://github.com/python-attrs/attrs/issues/835>`_,
`#886 <https://github.com/python-attrs/attrs/issues/886>`_
- ``import attrs`` has finally landed!
As of this release, you can finally import ``attrs`` using its proper name.

Not all names from the ``attr`` namespace have been transferred; most notably ``attr.s`` and ``attr.ib`` are missing.
See ``attrs.define`` and ``attrs.field`` if you haven't seen our next-generation APIs yet.
A more elaborate explanation can be found `On The Core API Names <https://www.attrs.org/en/latest/names.html>`_

This feature is at least for one release **provisional**.
We don't *plan* on changing anything, but such a big change is unlikely to go perfectly on the first strike.

The API docs have been mostly updated, but it will be an ongoing effort to change everything to the new APIs.
Please note that we have **not** moved -- or even removed -- anything from ``attr``!

Please do report any bugs or documentation inconsistencies!
`#887 <https://github.com/python-attrs/attrs/issues/887>`_


Changes
^^^^^^^

- ``attr.asdict(retain_collection_types=False)`` (default) dumps collection-esque keys as tuples.
`#646 <https://github.com/python-attrs/attrs/issues/646>`_,
`#888 <https://github.com/python-attrs/attrs/issues/888>`_
- ``__match_args__`` are now generated to support Python 3.10's
`Structural Pattern Matching <https://docs.python.org/3.10/whatsnew/3.10.html#pep-634-structural-pattern-matching>`_.
This can be controlled by the ``match_args`` argument to the class decorators on Python 3.10 and later.
On older versions, it is never added and the argument is ignored.
`#815 <https://github.com/python-attrs/attrs/issues/815>`_
- 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.
`#817 <https://github.com/python-attrs/attrs/issues/817>`_
- The generated ``__repr__`` is significantly faster on Pythons with f-strings.
`#819 <https://github.com/python-attrs/attrs/issues/819>`_
- Attributes transformed via ``field_transformer`` are wrapped with ``AttrsClass`` again.
`#824 <https://github.com/python-attrs/attrs/issues/824>`_
- Generated source code is now cached more efficiently for identical classes.
`#828 <https://github.com/python-attrs/attrs/issues/828>`_
- Added ``attrs.converters.to_bool()``.
`#830 <https://github.com/python-attrs/attrs/issues/830>`_
- ``attrs.resolve_types()`` now resolves types of subclasses after the parents are resolved.
`#842 <https://github.com/python-attrs/attrs/issues/842>`_
`#843 <https://github.com/python-attrs/attrs/issues/843>`_
- Added new validators: ``lt(val)`` (< val), ``le(va)`` (≤ val), ``ge(val)`` (≥ val), ``gt(val)`` (> val), and ``maxlen(n)``.
`#845 <https://github.com/python-attrs/attrs/issues/845>`_
- ``attrs`` classes are now fully compatible with `cloudpickle <https://github.com/cloudpipe/cloudpickle>`_ (no need to disable ``repr`` anymore).
`#857 <https://github.com/python-attrs/attrs/issues/857>`_
- Added new context manager ``attrs.validators.disabled()`` and functions ``attrs.validators.(set|get)_disabled()``.
They deprecate ``attrs.(set|get)_run_validators()``.
All functions are interoperable and modify the same internal state.
They are not – and never were – thread-safe, though.
`#859 <https://github.com/python-attrs/attrs/issues/859>`_
- ``attrs.validators.matches_re()`` now accepts pre-compiled regular expressions in addition to pattern strings.
`#877 <https://github.com/python-attrs/attrs/issues/877>`_


----

.. towncrier release notes start

21.2.0 (2021-05-07)
-------------------
Expand Down
1 change: 0 additions & 1 deletion changelog.d/646.change.rst

This file was deleted.

4 changes: 0 additions & 4 deletions changelog.d/815.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/817.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/819.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/824.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/828.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/830.change.rst

This file was deleted.

4 changes: 0 additions & 4 deletions changelog.d/835.breaking.rst

This file was deleted.

2 changes: 0 additions & 2 deletions changelog.d/843.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/845.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/857.change.rst

This file was deleted.

4 changes: 0 additions & 4 deletions changelog.d/859.change.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/877.change.rst

This file was deleted.

4 changes: 0 additions & 4 deletions changelog.d/886.breaking.rst

This file was deleted.

14 changes: 0 additions & 14 deletions changelog.d/887.breaking.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/888.change.rst

This file was deleted.

2 changes: 1 addition & 1 deletion src/attr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from ._version_info import VersionInfo


__version__ = "21.3.0.dev0"
__version__ = "21.3.0"
__version_info__ = VersionInfo._from_version_string(__version__)

__title__ = "attrs"
Expand Down

0 comments on commit dd26edd

Please sign in to comment.