Skip to content

Commit 90386b6

Browse files
committed
Prepare 20.1.0
1 parent d523371 commit 90386b6

20 files changed

Lines changed: 107 additions & 105 deletions

CHANGELOG.rst

Lines changed: 106 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,116 @@ 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/master/changelog.d>`_ in our repository.
7+
.. towncrier release notes start
88
9-
..
10-
Do *NOT* add changelog entries here!
9+
20.1.0 (2020-08-20)
10+
-------------------
1111

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

14-
See https://www.attrs.org/en/latest/contributing.html#changelog for details.
15+
- Python 3.4 is not supported anymore.
16+
It has been unsupported by the Python core team for a while now, its PyPI downloads are negligible, and our CI provider removed it as a supported option.
17+
18+
It's very unlikely that ``attrs`` will break under 3.4 anytime soon, which is why we do *not* block its installation on Python 3.4.
19+
But we don't test it anymore and will block it once someone reports breakage.
20+
`#608 <https://github.com/python-attrs/attrs/issues/608>`_
21+
22+
23+
Deprecations
24+
^^^^^^^^^^^^
25+
26+
- Less of a deprecation and more of a heads up: the next release of ``attrs`` will introduce an ``attrs`` namespace.
27+
That means that you'll finally be able to run ``import attrs`` with new functions that aren't cute abbreviations and that will carry better defaults.
28+
29+
This should not break any of your code, because project-local packages have priority before installed ones.
30+
If this is a problem for you for some reason, please report it to our bug tracker and we'll figure something out.
31+
32+
The old ``attr`` namespace isn't going anywhere and its defaults are not changing – this is a purely additive measure.
33+
Please check out the linked issue for more details.
34+
35+
These new APIs have been added *provisionally* as part of #666 so you can try them out today and provide feedback.
36+
Learn more in the `API docs <https://www.attrs.org/en/stable/api.html#provisional-apis>`_.
37+
`#408 <https://github.com/python-attrs/attrs/issues/408>`_
38+
39+
40+
Changes
41+
^^^^^^^
42+
43+
- Added ``attr.resolve_types()``.
44+
It ensures that all forward-references and types in string form are resolved into concrete types.
45+
46+
You need this only if you need concrete types at runtime.
47+
That means that if you only use types for static type checking, you do **not** need this function.
48+
`#288 <https://github.com/python-attrs/attrs/issues/288>`_,
49+
`#302 <https://github.com/python-attrs/attrs/issues/302>`_
50+
- Added ``@attr.s(collect_by_mro=False)`` argument that if set to ``True`` fixes the collection of attributes from base classes.
51+
52+
It's only necessary for certain cases of multiple-inheritance but is kept off for now for backward-compatibility reasons.
53+
It will be turned on by default in the future.
54+
55+
As a side-effect, ``attr.Attribute`` now *always* has an ``inherited`` attribute indicating whether an attribute on a class was directly defined or inherited.
56+
`#428 <https://github.com/python-attrs/attrs/issues/428>`_,
57+
`#635 <https://github.com/python-attrs/attrs/issues/635>`_
58+
- On Python 3, all generated methods now have a docstring explaining that they have been created by ``attrs``.
59+
`#506 <https://github.com/python-attrs/attrs/issues/506>`_
60+
- It is now possible to prevent ``attrs`` from auto-generating the ``__setstate__`` and ``__getstate__`` methods that are required for pickling of slotted classes.
61+
62+
Either pass ``@attr.s(getstate_setstate=False)`` or pass ``@attr.s(auto_detect=True)`` and implement them yourself:
63+
if ``attrs`` finds either of the two methods directly on the decorated class, it assumes implicitly ``getstate_setstate=False`` (and implements neither).
64+
65+
This option works with dict classes but should never be necessary.
66+
`#512 <https://github.com/python-attrs/attrs/issues/512>`_,
67+
`#513 <https://github.com/python-attrs/attrs/issues/513>`_,
68+
`#642 <https://github.com/python-attrs/attrs/issues/642>`_
69+
- Fixed a ``ValueError: Cell is empty`` bug that could happen in some rare edge cases.
70+
`#590 <https://github.com/python-attrs/attrs/issues/590>`_
71+
- ``attrs`` can now automatically detect your own implementations and infer ``init=False``, ``repr=False``, ``eq=False``, ``order=False``, and ``hash=False`` if you set ``@attr.s(auto_detect=True)``.
72+
``attrs`` will ignore inherited methods.
73+
If the argument implies more than one method (e.g. ``eq=True`` creates both ``__eq__`` and ``__ne__``), it's enough for *one* of them to exist and ``attrs`` will create *neither*.
74+
75+
This feature requires Python 3.
76+
`#607 <https://github.com/python-attrs/attrs/issues/607>`_
77+
- Added ``attr.converters.pipe()``.
78+
The feature allows combining multiple conversion callbacks into one by piping the value through all of them, and retuning the last result.
79+
80+
As part of this feature, we had to relax the type information for converter callables.
81+
`#618 <https://github.com/python-attrs/attrs/issues/618>`_
82+
- Fixed serialization behavior of non-slots classes with ``cache_hash=True``.
83+
The hash cache will be cleared on operations which make "deep copies" of instances of classes with hash caching,
84+
though the cache will not be cleared with shallow copies like those made by ``copy.copy()``.
85+
86+
Previously, ``copy.deepcopy()`` or serialization and deserialization with ``pickle`` would result in an un-initialized object.
87+
88+
This change also allows the creation of ``cache_hash=True`` classes with a custom ``__setstate__``,
89+
which was previously forbidden (`#494 <https://github.com/python-attrs/attrs/issues/494>`_).
90+
`#620 <https://github.com/python-attrs/attrs/issues/620>`_
91+
- It is now possible to specify hooks that are called whenever an attribute is set **after** a class has been instantiated.
92+
93+
You can pass ``on_setattr`` both to ``@attr.s()`` to set the default for all attributes on a class, and to ``@attr.ib()`` to overwrite it for individual attributes.
94+
95+
``attrs`` also comes with a new module ``attr.setters`` that brings helpers that run validators, converters, or allow to freeze a subset of attributes.
96+
`#645 <https://github.com/python-attrs/attrs/issues/645>`_,
97+
`#660 <https://github.com/python-attrs/attrs/issues/660>`_
98+
- **Provisional** APIs called ``attr.define()``, ``attr.mutable()``, and ``attr.frozen()`` have been added.
99+
100+
They are only available on Python 3.6 and later, and call ``attr.s()`` with different default values.
101+
102+
If nothing comes up, they will become the official way for creating classes in 20.2.0 (see above).
103+
104+
**Please note** that it may take some time until mypy – and other tools that have dedicated support for ``attrs`` – recognize these new APIs.
105+
Please **do not** open issues on our bug tracker, there is nothing we can do about it.
106+
`#666 <https://github.com/python-attrs/attrs/issues/666>`_
107+
- We have also provisionally added ``attr.field()`` that supplants ``attr.ib()``.
108+
It also requires at least Python 3.6 and is keyword-only.
109+
Other than that, it only dropped a few arguments, but changed no defaults.
110+
111+
As with ``attr.s()``: ``attr.ib()`` is not going anywhere.
112+
`#669 <https://github.com/python-attrs/attrs/issues/669>`_
113+
114+
115+
----
15116

16-
.. towncrier release notes start
17117

18118
19.3.0 (2019-10-15)
19119
-------------------

changelog.d/288.change.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

changelog.d/302.change.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

changelog.d/408.deprecation.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

changelog.d/428.change.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

changelog.d/506.change.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/512.change.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

changelog.d/513.change.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

changelog.d/590.change.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.d/607.change.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)