Closed mikenerone closed 5 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
0dd5bc4
) 99.64% compared to head (0b1b5f2
) 99.64%.
If you're replacing ib
-> define
, you might as well go through and replace import attr
with import attrs
everywhere too.
If you're replacing
ib
->define
, you might as well go through and replaceimport attr
withimport attrs
everywhere too.
Happy to do that, as well, but that really does require increasing the constraint to >=21.3.0
, so I'll wait for consensus on what version to constrain to in the other thread. Edit: Ended up doing this.
Added two more commits for additional shorter syntaxes:
attrs.field(factory=X)
-> attrs.Factory(X)
attrs.field(default=X)
-> simply assign XAlong with a fix to a small typing error that this uncovered. The original line in src/trio/_core/_run.py
was:
_next_send_fn: Callable[[Any], object] = attr.ib(default=None)
The type annotation didn't allow the default value. I updated the annotation.
Hey @mikenerone, it looks like that was the first time we merged one of your PRs! Thanks so much! :tada: :birthday:
If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:
Github will automatically subscribe you to notifications on all our repositories. (But you can unsubscribe again if you don't want the spam.)
You'll be able to help us manage issues (add labels, close them, etc.)
You'll be able to review and merge other people's pull requests
You'll get a [member] badge next to your name when participating in the Trio repos, and you'll have the option of adding your name to our member's page and putting our icon on your Github profile (details)
If you want to read more, here's the relevant section in our contributing guide.
Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you.
If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out!
Only skimmed the changes, but seems fine to merge. For ease of review it's perhaps not great to bundle a bugfix with a verbose style change, (and slots changes, with is coolcat's hobbyhorse :P) but probably not worth splitting it up at this point.
@jakkdl By way of explanation, because the Pyright fix required a bump to the attrs
dep version, this PR really became an "update attrs
and use all of the next-gen interfaces that are now prescribed in this new version." From that perspective, this really was just a style PR resulting from the dep update. The "bugfix" part we got for free with the update - there are zero extra lines here to accomplish that. Also, there are no slots changes here, and in fact intentionally zero changes in any functional way like that.
[The changes related to this update fall into three categories:
attrs>=23.2.0
is now required (based on this comment thread plus needing to bump to at least 22.2.0 anyway to support Pyright).CancelStatus
andCancelScope
(this is required for Pyright to recognize private attributes as constructor kwargs).attrs
per previous chat discussion.import attr
->import attrs
everywhereattr.ib
->attrs.field
attr.s
->attrs.define
orattrs.frozen
, depending on existingfrozen
kwarg and with adjustments made to all calls to account forslots=True
now being the default).attrs.field(factory=X)
->attrs.Factory(X)
attrs.field(default=X)
-> simply assign XNote: there's no new logic to be tested. All existing tests pass unchanged (except for non-logic name changes resulting from item 3 above).