From 73b1a1e6a57a2cf9550bb9e97b4dfb8c68760e6b Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Sat, 14 Feb 2026 13:37:16 +0100 Subject: [PATCH] Prevent IncEx reexport from being stripped from stubs. pyright --createstub strips out IncEx reexport line added by #14641, because it comes from module that it thinks is private. This patch makes public at fastapi level. --- fastapi/types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fastapi/types.py b/fastapi/types.py index 1fb86e13b..fc8e96b5e 100644 --- a/fastapi/types.py +++ b/fastapi/types.py @@ -1,12 +1,13 @@ import types from collections.abc import Callable from enum import Enum -from typing import Any, TypeVar, Union +from typing import Any, TypeAlias, TypeVar, Union from pydantic import BaseModel -from pydantic.main import IncEx as IncEx +from pydantic.main import IncEx as _IncEx DecoratedCallable = TypeVar("DecoratedCallable", bound=Callable[..., Any]) UnionType = getattr(types, "UnionType", Union) ModelNameMap = dict[type[BaseModel] | type[Enum], str] DependencyCacheKey = tuple[Callable[..., Any] | None, tuple[str, ...], str] +IncEx: TypeAlias = _IncEx