You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem:
PyCharm gives ugly type check warning when I try to run FastAPI app with uvicorn programmatically passing to uvicorn.run() the application instance of the FastAPI class.
I have created the issue in the FastAPI repository and they say the problem is since FastAPI extends from Starlette the issue is that Starlette is not typed to an ASGIApplication, i.e. fix must be done in the Starlette code: fastapi/fastapi#3927
Steps to reproduce:
Copy and paste to PyCharm the example code from the official FastAPI documentation Debugging → Call uvicorn
PyCharm will highlight the app argument at the last line uvicorn.run(app, host="0.0.0.0", port=8000) with warning: Expected type 'Union[Type[ASGI2Protocol], (Union[HTTPScope, WebSocketScope, LifespanScope], () -> Awaitable[Union[HTTPRequestEvent, HTTPDisconnectEvent, WebSocketConnectEvent, WebSocketReceiveEvent, WebSocketDisconnectEvent, LifespanStartupEvent, LifespanShutdownEvent]], (Union[HTTPResponseStartEvent, HTTPResponseBodyEvent, HTTPServerPushEvent, HTTPDisconnectEvent, WebSocketAcceptEvent, WebSocketSendEvent, WebSocketResponseStartEvent, WebSocketResponseBodyEvent, WebSocketCloseEvent, LifespanStartupCompleteEvent, LifespanStartupFailedEvent, LifespanShutdownCompleteEvent, LifespanShutdownFailedEvent]) -> Awaitable[None]) -> Awaitable[None], str]', got 'FastAPI' instead
The text was updated successfully, but these errors were encountered:
The problem:
PyCharm gives ugly type check warning when I try to run FastAPI app with uvicorn programmatically passing to
uvicorn.run()
the application instance of the FastAPI class.I have created the issue in the FastAPI repository and they say the problem is since FastAPI extends from Starlette the issue is that Starlette is not typed to an
ASGIApplication
, i.e. fix must be done in the Starlette code:fastapi/fastapi#3927
Steps to reproduce:
Copy and paste to PyCharm the example code from the official FastAPI documentation Debugging → Call uvicorn
PyCharm will highlight the
app
argument at the last lineuvicorn.run(app, host="0.0.0.0", port=8000)
with warning:Expected type 'Union[Type[ASGI2Protocol], (Union[HTTPScope, WebSocketScope, LifespanScope], () -> Awaitable[Union[HTTPRequestEvent, HTTPDisconnectEvent, WebSocketConnectEvent, WebSocketReceiveEvent, WebSocketDisconnectEvent, LifespanStartupEvent, LifespanShutdownEvent]], (Union[HTTPResponseStartEvent, HTTPResponseBodyEvent, HTTPServerPushEvent, HTTPDisconnectEvent, WebSocketAcceptEvent, WebSocketSendEvent, WebSocketResponseStartEvent, WebSocketResponseBodyEvent, WebSocketCloseEvent, LifespanStartupCompleteEvent, LifespanStartupFailedEvent, LifespanShutdownCompleteEvent, LifespanShutdownFailedEvent]) -> Awaitable[None]) -> Awaitable[None], str]', got 'FastAPI' instead
The text was updated successfully, but these errors were encountered: