-
Notifications
You must be signed in to change notification settings - Fork 159
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
Make h2.events more typing-friendly #1296
base: master
Are you sure you want to change the base?
Conversation
13361d9
to
ab9c1c6
Compare
LGTM! Thanks!
I assume you intended this as "most users will not use this API and won't be affected by this change"? Please add a quick note into the changelog. Thanks! |
If by "this API" you mean the I will add constructors for the other events and then also a changelog entry. |
I've switched to Python 3.9 requires some extra logic because it doesn't have |
I do like dataclasses! I do like the kw_only pattern! I don't like the extra fuzz about py3.9. But since py3.9 becomes EOL later this year, I think its acceptable. Happy to hear other thoughts on it! |
events.WindowUpdated
This is ready for review now. With these changes we get from 31 mypy complaints down to 3 in mitmproxy (see linked PR for the fixes). All other downstream consumers should profit similarly. |
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.
Please add a changelog entry.
The docs should be auto-generated, or do you think we need to update something?
https://github.com/python-hyper/h2/blob/master/docs/source/api.rst#events
LGTM! Thanks!
This PR adds proper constructors for most of the h2 events. This allows us to tighten the type annotations, simplifying type checks in downstream implementations. These events should not be instantiated by anyone except h2 itself, so it shouldn't be a breaking change.
Based on #1297.