Bump attrs from 21.2.0 to 21.3.0
Created by: dependabot[bot]
Bumps attrs from 21.2.0 to 21.3.0.
Release notes
Sourced from attrs's releases.
21.3.0
This is a big release in the history of
attrsand finishes an arc that took way too long and also delayed this very overdue release. But it's done:import attrsthat has been talked about for years[^issue], but fell victim to “just this one more thing” has finally landed.From now on, modern
attrscode looks like this:from attrs import define @define class HelloWorld: modern: bool = TrueThe
define/fieldAPIs have been around for over a year and were very popular, now the rest of the package followed suit. I'm very excited thatattrsremains relevant and keeps evolving over now more than half a decade. If you're curious about some of the background, the docs now contain a short explanation and history lesson. As long as our users keep pushing us, we will keep pushing forward class generation in Python!Big thanks to my GitHub Sponsors, Tidelift subscribers, and Ko-fi buyers that help me mustering the motivation for such long-running project!
Since the release took so long, there's more highlights than we can enumerate here, we'd just like to point out a breaking change in the new APIs: converters now run on setting attributes by default. If this is causing problems to you, you can disable that behavior by setting
@define(on_setattr=[]).[^issue]: I have an issue from 2018 that I wanted to "come back the moment this lands".
Full Changelog
Backward-incompatible Changes
When using
@define, converters are now run by default when setting an attribute on an instance -- additionally to validators. I.e. the new default ison_setattr=[attrs.setters.convert, attrs.setters.validate].This is unfortunately a breaking change, but it was an oversight, impossible to raise a
DeprecationWarningabout, and it's better to fix it now while the APIs are very fresh with few users. #835, #886
import attrshas finally landed! As of this release, you can finally importattrsusing its proper name.Not all names from the
attrnamespace have been transferred; most notablyattr.sandattr.ibare missing. Seeattrs.defineandattrs.fieldif you haven't seen our next-generation APIs yet. A more elaborate explanation can be found On The Core API NamesThis 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 thematch_argsargument 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@defineand@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_transformerare wrapped withAttrsClassagain. #824- Generated source code is now cached more efficiently for identical classes. #828
- Added
attrs.converters.to_bool(). #830
... (truncated)
Changelog
Sourced from attrs's changelog.
21.3.0 (2021-12-28)
Backward-incompatible Changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When using
@define, converters are now run by default when setting an attribute on an instance -- additionally to validators. I.e. the new default ison_setattr=[attrs.setters.convert, attrs.setters.validate].This is unfortunately a breaking change, but it was an oversight, impossible to raise a
DeprecationWarningabout, 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) <https://github.com/python-attrs/attrs/issues/835>,[#886](https://github.com/python-attrs/attrs/issues/886) <https://github.com/python-attrs/attrs/issues/886>
import attrshas finally landed! As of this release, you can finally importattrsusing its proper name.Not all names from the
attrnamespace have been transferred; most notablyattr.sandattr.ibare missing. Seeattrs.defineandattrs.fieldif you haven't seen our next-generation APIs yet. A more elaborate explanation can be foundOn 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) <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) <https://github.com/python-attrs/attrs/issues/646>,[#888](https://github.com/python-attrs/attrs/issues/888) <https://github.com/python-attrs/attrs/issues/888>__match_args__are now generated to support Python 3.10'sStructural Pattern Matching <https://docs.python.org/3.10/whatsnew/3.10.html#pep-634-structural-pattern-matching>. This can be controlled by thematch_argsargument 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) <https://github.com/python-attrs/attrs/issues/815>- If the class-level on_setattr is set to
attrs.setters.validate(default in@defineand@mutable) but no field defines a validator, pretend that it's not set.[#817](https://github.com/python-attrs/attrs/issues/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) <https://github.com/python-attrs/attrs/issues/819>_- Attributes transformed via
field_transformerare wrapped withAttrsClassagain.[#824](https://github.com/python-attrs/attrs/issues/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) <https://github.com/python-attrs/attrs/issues/828>_- Added
attrs.converters.to_bool().[#830](https://github.com/python-attrs/attrs/issues/830) <https://github.com/python-attrs/attrs/issues/830>_
... (truncated)
Commits
-
dd26eddPrepare 21.3.0 -
20bf4b6Go over CONTRIBUTING.md -
d528dd4Fix more links -
fcfb5a6Last pass over changelogs -
e098734Add logo to PyPI description -
26c0cefStreamline workflow -
3333e74Remove dead achor -
2d77d83Fix dataclass_transform links -
b4dc9b0Better 2.7 example -
d4e3220Use attrs namespace throughout examples.rst - Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
-
@dependabot rebasewill rebase this PR -
@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it -
@dependabot mergewill merge this PR after your CI passes on it -
@dependabot squash and mergewill squash and merge this PR after your CI passes on it -
@dependabot cancel mergewill cancel a previously requested merge and block automerging -
@dependabot reopenwill reopen this PR if it is closed -
@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually -
@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) -
@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)