File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -688,6 +688,27 @@ extensions for a FastAPI / dependency-injector codebase:
688688 },
689689 )
690690
691+ FastAPI views and dependencies that rely on parameter defaults as
692+ markers (``param: str = Header(...) ``, ``svc: Service = Depends(...) ``,
693+ ``Provide[Container.x] ``) need Cython's C-level annotation typing
694+ disabled. The default in Cython 3.x is ``annotation_typing=True ``, which
695+ generates ``isinstance `` checks against the annotated types and rejects
696+ the marker objects at call time. Opt out per-function:
697+
698+ .. code-block :: python
699+
700+ import cython
701+
702+ @cython.annotation_typing (False )
703+ async def list_users (
704+ svc : UserService = Depends(Provide[Container.user_service]),
705+ ) -> list[User]:
706+ return await svc.list()
707+
708+ Apply the decorator to every FastAPI view or dependency callable that
709+ takes a marker-style default. Module-level ``annotation_typing=False ``
710+ works too if the whole module is FastAPI-bound.
711+
691712Few notes on performance
692713------------------------
693714
You can’t perform that action at this time.
0 commit comments