Make h2.events more typing-friendly#1296
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. |
Kriechi
left a comment
There was a problem hiding this comment.
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.