Python 3.4 is not supported anymore. 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.
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. But we don't test it anymore and will block it once someone reports breakage. #608
Deprecations
Less of a deprecation and more of a heads up: the next release of attrs will introduce an attrs namespace. 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.
This should not break any of your code, because project-local packages have priority before installed ones. If this is a problem for you for some reason, please report it to our bug tracker and we'll figure something out.
The old attr namespace isn't going anywhere and its defaults are not changing -- this is a purely additive measure. Please check out the linked issue for more details.
These new APIs have been added provisionally as part of #666 so you can try them out today and provide feedback. Learn more in the API docs. #408
Changes
Added attr.resolve_types(). It ensures that all forward-references and types in string form are resolved into concrete types.
You need this only if you need concrete types at runtime. That means that if you only use types for static type checking, you do not need this function. #288, #302
Added @attr.s(collect_by_mro=False) argument that if set to True fixes the collection of attributes from base classes.
It's only necessary for certain cases of multiple-inheritance but is kept off for now for backward-compatibility reasons. It will be turned on by default in the future.
As a side-effect, attr.Attribute now always has an inherited attribute indicating whether an attribute on a class was directly defined or inherited. #428, #635
On Python 3, all generated methods now have a docstring explaining that they have been created by attrs. #506
It is now possible to prevent attrs from auto-generating the __setstate__ and __getstate__ methods that are required for pickling of slotted classes.
Either pass @attr.s(getstate_setstate=False) or pass @attr.s(auto_detect=True) and implement them yourself: if attrs finds either of the two methods directly on the decorated class, it assumes implicitly getstate_setstate=False (and implements neither).
This option works with dict classes but should never be necessary. #512, #513, #642
Fixed a ValueError: Cell is empty bug that could happen in some rare edge cases. #590
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). attrs will ignore inherited methods. 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.
Added attr.converters.pipe(). The feature allows combining multiple conversion callbacks into one by piping the value through all of them, and retuning the last result.
As part of this feature, we had to relax the type information for converter callables. #618
Python 3.4 is not supported anymore. 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.
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. But we don't test it anymore and will block it once someone reports breakage. #608
Deprecations
Less of a deprecation and more of a heads up: the next release of attrs will introduce an attrs namespace. 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.
This should not break any of your code, because project-local packages have priority before installed ones. If this is a problem for you for some reason, please report it to our bug tracker and we'll figure something out.
The old attr namespace isn't going anywhere and its defaults are not changing – this is a purely additive measure. Please check out the linked issue for more details.
These new APIs have been added provisionally as part of #666 so you can try them out today and provide feedback. Learn more in the API docs. #408
Changes
Added attr.resolve_types(). It ensures that all forward-references and types in string form are resolved into concrete types.
You need this only if you need concrete types at runtime. That means that if you only use types for static type checking, you do not need this function. #288, #302
Added @attr.s(collect_by_mro=False) argument that if set to True fixes the collection of attributes from base classes.
It's only necessary for certain cases of multiple-inheritance but is kept off for now for backward-compatibility reasons. It will be turned on by default in the future.
As a side-effect, attr.Attribute now always has an inherited attribute indicating whether an attribute on a class was directly defined or inherited. #428, #635
On Python 3, all generated methods now have a docstring explaining that they have been created by attrs. #506
It is now possible to prevent attrs from auto-generating the __setstate__ and __getstate__ methods that are required for pickling of slotted classes.
Either pass @attr.s(getstate_setstate=False) or pass @attr.s(auto_detect=True) and implement them yourself: if attrs finds either of the two methods directly on the decorated class, it assumes implicitly getstate_setstate=False (and implements neither).
This option works with dict classes but should never be necessary. #512, #513, #642
Fixed a ValueError: Cell is empty bug that could happen in some rare edge cases. #590
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). attrs will ignore inherited methods. 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.
Added attr.converters.pipe(). The feature allows combining multiple conversion callbacks into one by piping the value through all of them, and retuning the last result.
As part of this feature, we had to relax the type information for converter callables. #618
Fixed serialization behavior of non-slots classes with cache_hash=True. The hash cache will be cleared on operations which make "deep copies" of instances of classes with hash caching, though the cache will not be cleared with shallow copies like those made by copy.copy().
Previously, copy.deepcopy() or serialization and deserialization with pickle would result in an un-initialized object.
This change also allows the creation of cache_hash=True classes with a custom __setstate__, which was previously forbidden (#494). #620
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.
If all status checks pass Dependabot will automatically merge this pull request.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will 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 version` will 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 dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Bumps attrs from 19.3.0 to 20.1.0.
Release notes
Sourced from attrs's releases.
Changelog
Sourced from attrs's changelog.
Commits
90386b6
Prepare 20.1.0d523371
Prevent reST getting upset by multiple links to #666fda437c
Add attr.field (#669)c67a649
Explain that slotted classes don't support multiple inheritanceb02335f
Add attr.define/mutable/frozen (#666)131d147
Fix docaea6d6f
Announceimport attrs
d59b154
Clean up api docs a bitd4150f2
Run CI against 3.9 pre-release (#664)106c33c
Clear setattr if it was inherited && written by us (#663)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
.If all status checks pass Dependabot will automatically merge this pull request.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will 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 version` will 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 dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired)