Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
Comments
✨ Support Starlette 0.52.0+ genericRequest#14863
✨ Support Starlette 0.52.0+ genericRequest#14863ollie-bell wants to merge 1 commit intofastapi:masterfrom
Request#14863Conversation
codspeed-hqbot commentedFeb 7, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
ollie-bell commentedFeb 7, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The test run for python 3.9 which uses lowest-direct resolution picks up starlette 0.45.3, which doesn't have this feature available - should the newly added test be marked as |
98f2eb5 to44e5a71CompareRequestYuriiMotov commentedFeb 9, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think we should just skip it for starlette less than 0.52.0 ( |
44e5a71 to940aa5dCompare📝 Docs previewLast commit940aa5d at:https://8b5ff73f.fastapitiangolo.pages.dev |
1 similar comment
📝 Docs previewLast commit940aa5d at:https://8b5ff73f.fastapitiangolo.pages.dev |
ollie-bell commentedFeb 9, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks, that's done now ✅ I introduced the |
YuriiMotov commentedFeb 9, 2026
I would actually avoid adding new dependency for this - it's quite easy to parse version number into a tuple and compare with |
YuriiMotov left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM!
Not sure about adding a (resolved)packaging to test dependencies.
Type hints in IDE work:

Code example
fromcollections.abcimportAsyncGeneratorfromcontextlibimportasynccontextmanagerfromtypingimportTypedDictfromfastapiimportFastAPI,RequestclassMyState(TypedDict):a:strb:int@asynccontextmanagerasyncdeflifespan(app:FastAPI)->AsyncGenerator[MyState]:yieldMyState(a="hello",b=42)app=FastAPI(lifespan=lifespan)@app.get("/")defmain(request:Request[MyState])->dict[str,str]:_=request.statereturn {"message":"Hello World"}
940aa5d tobce4d6eCompareollie-bell commentedFeb 9, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
That's understood - I've updated to parse fastapi/fastapi/_compat/shared.py Line 33 ine94028a
|
This comment was marked as resolved.
This comment was marked as resolved.
bce4d6e to0fa4abdCompareThis pull request has a merge conflict that needs to be resolved. |
47c4888 toc940ab7Compare
Uh oh!
There was an error while loading.Please reload this page.
Starlette 0.52.0 introduced dictionary-style syntax for improve type safety when accessing
State. This PR adds support for this pattern when using FastAPI.More context is given in this discussion:#14695 (comment)
Related:
#13965 - it seems like this draft PR was made prior to Starlette adding this functionality natively. Is there anything from this PR which should be brought into here?