From dd26edd68e12879f716c6554f25d957af299b801 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Tue, 28 Dec 2021 06:59:45 +0100 Subject: [PATCH] Prepare 21.3.0 --- CHANGELOG.rst | 72 +++++++++++++++++++++++++++++++++--- changelog.d/646.change.rst | 1 - changelog.d/815.change.rst | 4 -- changelog.d/817.change.rst | 1 - changelog.d/819.change.rst | 1 - changelog.d/824.change.rst | 1 - changelog.d/828.change.rst | 1 - changelog.d/830.change.rst | 1 - changelog.d/835.breaking.rst | 4 -- changelog.d/843.change.rst | 2 - changelog.d/845.change.rst | 1 - changelog.d/857.change.rst | 1 - changelog.d/859.change.rst | 4 -- changelog.d/877.change.rst | 1 - changelog.d/886.breaking.rst | 4 -- changelog.d/887.breaking.rst | 14 ------- changelog.d/888.change.rst | 1 - src/attr/__init__.py | 2 +- 18 files changed, 67 insertions(+), 49 deletions(-) delete mode 100644 changelog.d/646.change.rst delete mode 100644 changelog.d/815.change.rst delete mode 100644 changelog.d/817.change.rst delete mode 100644 changelog.d/819.change.rst delete mode 100644 changelog.d/824.change.rst delete mode 100644 changelog.d/828.change.rst delete mode 100644 changelog.d/830.change.rst delete mode 100644 changelog.d/835.breaking.rst delete mode 100644 changelog.d/843.change.rst delete mode 100644 changelog.d/845.change.rst delete mode 100644 changelog.d/857.change.rst delete mode 100644 changelog.d/859.change.rst delete mode 100644 changelog.d/877.change.rst delete mode 100644 changelog.d/886.breaking.rst delete mode 100644 changelog.d/887.breaking.rst delete mode 100644 changelog.d/888.change.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7c532bc46..c4298c414 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 `_ 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 `_, + `#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 `_ + + 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 `_ + + +Changes +^^^^^^^ + +- ``attr.asdict(retain_collection_types=False)`` (default) dumps collection-esque keys as tuples. + `#646 `_, + `#888 `_ +- ``__match_args__`` are now generated to support Python 3.10's + `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 `_ +- 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 `_ +- The generated ``__repr__`` is significantly faster on Pythons with f-strings. + `#819 `_ +- Attributes transformed via ``field_transformer`` are wrapped with ``AttrsClass`` again. + `#824 `_ +- Generated source code is now cached more efficiently for identical classes. + `#828 `_ +- Added ``attrs.converters.to_bool()``. + `#830 `_ +- ``attrs.resolve_types()`` now resolves types of subclasses after the parents are resolved. + `#842 `_ + `#843 `_ +- Added new validators: ``lt(val)`` (< val), ``le(va)`` (≤ val), ``ge(val)`` (≥ val), ``gt(val)`` (> val), and ``maxlen(n)``. + `#845 `_ +- ``attrs`` classes are now fully compatible with `cloudpickle `_ (no need to disable ``repr`` anymore). + `#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 `_ +- ``attrs.validators.matches_re()`` now accepts pre-compiled regular expressions in addition to pattern strings. + `#877 `_ + + +---- -.. towncrier release notes start 21.2.0 (2021-05-07) ------------------- diff --git a/changelog.d/646.change.rst b/changelog.d/646.change.rst deleted file mode 100644 index aa3e3893d..000000000 --- a/changelog.d/646.change.rst +++ /dev/null @@ -1 +0,0 @@ -``attr.asdict(retain_collection_types=False)`` (default) dumps collection-esque keys as tuples. diff --git a/changelog.d/815.change.rst b/changelog.d/815.change.rst deleted file mode 100644 index e6c368453..000000000 --- a/changelog.d/815.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -``__match_args__`` are now generated to support Python 3.10's -`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. diff --git a/changelog.d/817.change.rst b/changelog.d/817.change.rst deleted file mode 100644 index 9c5715279..000000000 --- a/changelog.d/817.change.rst +++ /dev/null @@ -1 +0,0 @@ -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. diff --git a/changelog.d/819.change.rst b/changelog.d/819.change.rst deleted file mode 100644 index 51fc54b2f..000000000 --- a/changelog.d/819.change.rst +++ /dev/null @@ -1 +0,0 @@ -The generated ``__repr__`` is significantly faster on Pythons with f-strings. diff --git a/changelog.d/824.change.rst b/changelog.d/824.change.rst deleted file mode 100644 index 4d3e6acda..000000000 --- a/changelog.d/824.change.rst +++ /dev/null @@ -1 +0,0 @@ -Attributes transformed via ``field_transformer`` are wrapped with ``AttrsClass`` again. diff --git a/changelog.d/828.change.rst b/changelog.d/828.change.rst deleted file mode 100644 index b4a5454c8..000000000 --- a/changelog.d/828.change.rst +++ /dev/null @@ -1 +0,0 @@ -Generated source code is now cached more efficiently for identical classes. diff --git a/changelog.d/830.change.rst b/changelog.d/830.change.rst deleted file mode 100644 index ce1381391..000000000 --- a/changelog.d/830.change.rst +++ /dev/null @@ -1 +0,0 @@ -Added ``attrs.converters.to_bool()``. diff --git a/changelog.d/835.breaking.rst b/changelog.d/835.breaking.rst deleted file mode 100644 index 369a22f33..000000000 --- a/changelog.d/835.breaking.rst +++ /dev/null @@ -1,4 +0,0 @@ -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. diff --git a/changelog.d/843.change.rst b/changelog.d/843.change.rst deleted file mode 100644 index ed48f9821..000000000 --- a/changelog.d/843.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -``attrs.resolve_types()`` now resolves types of subclasses after the parents are resolved. -`#842 `_ diff --git a/changelog.d/845.change.rst b/changelog.d/845.change.rst deleted file mode 100644 index 80f3f7da9..000000000 --- a/changelog.d/845.change.rst +++ /dev/null @@ -1 +0,0 @@ -Added new validators: ``lt(val)`` (< val), ``le(va)`` (≤ val), ``ge(val)`` (≥ val), ``gt(val)`` (> val), and ``maxlen(n)``. diff --git a/changelog.d/857.change.rst b/changelog.d/857.change.rst deleted file mode 100644 index 66fd13fa4..000000000 --- a/changelog.d/857.change.rst +++ /dev/null @@ -1 +0,0 @@ -``attrs`` classes are now fully compatible with `cloudpickle `_ (no need to disable ``repr`` anymore). diff --git a/changelog.d/859.change.rst b/changelog.d/859.change.rst deleted file mode 100644 index 12a965eea..000000000 --- a/changelog.d/859.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -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. diff --git a/changelog.d/877.change.rst b/changelog.d/877.change.rst deleted file mode 100644 index 2ad5fcebd..000000000 --- a/changelog.d/877.change.rst +++ /dev/null @@ -1 +0,0 @@ -``attrs.validators.matches_re()`` now accepts pre-compiled regular expressions in addition to pattern strings. diff --git a/changelog.d/886.breaking.rst b/changelog.d/886.breaking.rst deleted file mode 100644 index 369a22f33..000000000 --- a/changelog.d/886.breaking.rst +++ /dev/null @@ -1,4 +0,0 @@ -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. diff --git a/changelog.d/887.breaking.rst b/changelog.d/887.breaking.rst deleted file mode 100644 index 98b4079ff..000000000 --- a/changelog.d/887.breaking.rst +++ /dev/null @@ -1,14 +0,0 @@ -``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 `_ - -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! diff --git a/changelog.d/888.change.rst b/changelog.d/888.change.rst deleted file mode 100644 index aa3e3893d..000000000 --- a/changelog.d/888.change.rst +++ /dev/null @@ -1 +0,0 @@ -``attr.asdict(retain_collection_types=False)`` (default) dumps collection-esque keys as tuples. diff --git a/src/attr/__init__.py b/src/attr/__init__.py index 81cd2da8f..dc7d68833 100644 --- a/src/attr/__init__.py +++ b/src/attr/__init__.py @@ -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"