-
Notifications
You must be signed in to change notification settings - Fork 10
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
support aiohttp-3.8.0 #31
Conversation
aiodogstatsd/contrib/aiohttp.py
Outdated
@@ -3,7 +3,7 @@ | |||
|
|||
from aiohttp import web | |||
from aiohttp.web_app import _Middleware | |||
from aiohttp.web_routedef import _SimpleHandler | |||
from aiohttp.typedefs import Handler |
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.
this will break compatibility with aiohttp < 3.8.0
should we use some kind of conditional imports?
try:
from aiohttp.typedefs import Handler
except ImportError:
from aiohttp.web_routedef import _SimpleHandler as Handler
aiodogstatsd/contrib/aiohttp.py
Outdated
@@ -3,7 +3,7 @@ | |||
|
|||
from aiohttp import web | |||
from aiohttp.web_app import _Middleware |
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.
this one was also moved to aiohttp.typedefs
, but wasn't released yet.
for future stability, I would recommend to use the same mechanic with conditional import.
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.
Duh, of course, sorry about that. I should have thought about backwards compatibility. I shall make your suggested changes.
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.
Ok, I've made the changes, amended the commit and pushed.
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.
looks good, but I am not sure if mypy
will be satisfied. did you run make lint
against your code?
55cc99e
to
eb2a04e
Compare
This fixes the rename of aiohttp.web_routedef._SimpleHandler to aiohttp.typedefs.Handler while remaining backwards incompatible. This also fixes the upcoming rename of aiohttp.web_app._Middleware to aiohttp.typedefs.Middleware.
Yes, mypy is not satisfied.
I don't know how to fix that since in 3.8.0 I don't use mypy for linting in our codebases, so what do you suggest? |
well, as far as I see,
doesn't make much sense as we use these classes only for typing and ignoring types makes it kinda useless
this is the simplest and the most stable solution, but it also kinda compromises idea of type checking. as I am not a maintainer of this library, I can't make this decision :) |
Hi everyone, thanks for the contribution, but decided to go with another solution. Nevertheless, fix already in master. |
This fixes the rename of aiohttp.web_routedef._SimpleHandler to aiohttp.typedefs.Handler