-
Notifications
You must be signed in to change notification settings - Fork 68
annotations for WsgiMiddleware cause app to not be startable #71
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
Comments
I can work on fixing this if you give me some pointers on how you'd like to see this resolved! |
Thanks for raising this. For now, you'll have to use the workaround of the "old syntax", this bug should be against the worker process. I'll add an issue there. Example workaround: import logging
import azure.functions as func
from ..FlaskApp.wsgi import application
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.WsgiMiddleware(application).handle(req, context) |
@Hazhzeng it looks like the actual fix needs to happen in the code which checks the annotations -- it needs to recognize that |
it looks like it is being a little too strict on the typing here
the
@property
is annotated correctly herebut the function it returns, uses
Optional[Context]
instead heremypy allows this because the
_handler
is a more-permissive compatible signature, but thefunc
tool forbids this (incorrectly)I can work around this by wrapping the function trivially -- another alternative would be to make
main
call that instead of having a property (this would incur a function call overhead per call though, but that's probably ok?) -- that would be the easiest patch without having to refactor the type checking code infunc
The text was updated successfully, but these errors were encountered: