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
re-implement simple CORS middleware for blackd #2500
Conversation
|
||
return resp | ||
|
||
return impl # type: ignore |
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.
mypy can't figure out the type of impl
here unfortunately - it complains about returning an Any
value instead of Middleware
. @JelleZijlstra any ideas?
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.
What version of aiohttp are we using? On master (https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_middlewares.py#L34) it looks like the decorator does nothing.
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 like 3.6 and above:
Line 89 in d08f95a
"d": ["aiohttp>=3.6.0"], |
We could update this, but I'd prefer doing it in a separate PR
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.
For what it's worth the decorator does do something on aiohttp 3.6: https://github.com/aio-libs/aiohttp/blob/3.6/aiohttp/web_middlewares.py#L34. I'm not sure why mypy turns the function into Any here though; the type annotations seem like they should work.
I'm very concerned about the changes within Pipfile.lock. I suspect pipenv removed too much, eg. dataclasses. I have some experience (un)fortunately in this regard and I'll try to reduce the lockfile changes to avoid breakage. |
You're right, |
65e9738
to
d08f95a
Compare
I gave up on trying to get pipenv to not revert the dataclasses version :) |
Although there's a little bit of extra changes. They should be fine tho. Dataclasses is still broken on Python 3.7+ but I'll fix that after this.
I wasn't able to get the cleanest Pipfile.lock diff ever but this should do for the time being (ignoring the dataclasses fiasco). |
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 looks fine to me but the only knowledge of CORS I have comes from a quick read of the MDN documentation. I hope someone else with more web dev experience can pitch in.
Description
This PR removes Black's dependency on
aiohttp-cors
because it seems to be unmaintained and spewingDeprecationWarnings
(due to the use of@coroutine
decorators).TODO
aiohttp-cors
fromsetup.py
aiohttp-cors
fromPipfile