-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
🎨 Fix types for lifespan, upgrade Starlette to 0.26.1 #9245
Conversation
🚀 Deployed on https://640fd26830532a16cd315587--fastapi.netlify.app |
📝 Docs preview for commit 2e373fa at: https://640dbed4fbc9f768d2b35cd4--fastapi.netlify.app |
You also need to add |
Good point, thanks @adriangb! Trying it locally I realized I had to redefine |
Hmm I’m surprised the |
📝 Docs preview for commit 4578cfb at: https://640fd2b293def71708f521d2--fastapi.netlify.app |
I'm trying with this example: from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from fastapi import FastAPI
@asynccontextmanager
async def lifespan(_: FastAPI) -> AsyncGenerator[None, None]:
...
yield
...
app = FastAPI(lifespan=lifespan) And I get this error:
...I guess it would be fine for external things to have |
Weird, we even have a test in Starlette: https://github.com/encode/starlette/blob/8965f8849977b5752e415722a83aa00049f80ff3/tests/test_applications.py#L539-L550 |
Ah, yeah, the error is not in the lifespan, but that the class doesn't have the custom attributes |
🎨 Fix types for lifespan, depends on encode/starlette#2077