-
-
Notifications
You must be signed in to change notification settings - Fork 386
Perform attr order checks after field transformer. #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea and looks good. :)
Thanks! I just merged the latest autocommit from main into the PR so assuming all checks pass, I think it's ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Great to meet a fellow Python YouTuber with checks notes 100x subscribers. :D
This worked on 25.1.0 but was inadvertently broken by python-attrs#1401
This worked on 25.1.0 but was inadvertently broken by python-attrs#1401
* Cope with `field_transformer` being a generator This worked on 25.1.0 but was inadvertently broken by #1401 * Update src/attr/_make.py Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com> --------- Co-authored-by: Hynek Schlawack <hs@ox.cx>
Fixes: #1147
Summary
Previously, attrs performed order checks for mandatory vs non-mandatory attributes before applying the field transformer, giving errors even when the field transformer intended to fix such errors such as by supplying defaults, factories, making args keyword-only, removing attrs, or reordering attrs.
This PR moves the checks after the field transformer.
Pull Request Check List
main
branch – use a separate branch!Our CI fails if coverage is not 100%.
.pyi
).tests/typing_example.py
.attr/__init__.pyi
, they've also been re-imported inattrs/__init__.pyi
.docs/api.rst
by hand.@attr.s()
and@attrs.define()
have to be added by hand too.versionadded
,versionchanged
, ordeprecated
directives.The next version is the second number in the current release + 1.
The first number represents the current year.
So if the current version on PyPI is 22.2.0, the next version is gonna be 22.3.0.
If the next version is the first in the new year, it'll be 23.1.0.
attrs.define()
andattr.s()
, you have to add version directives to both..rst
and.md
files is written using semantic newlines.changelog.d
.