fix: stream part generic order (#7134)

this is technically breaking but is a fix given dependency of output t
on state t
This commit is contained in:
Sydney Runkle
2026-03-12 11:58:04 -04:00
committed by GitHub
parent 210c4b3877
commit 682814e944
4 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -2456,7 +2456,7 @@ class Pregel(
debug: bool | None = None,
version: Literal["v2"],
**kwargs: Unpack[DeprecatedKwargs],
) -> Iterator[StreamPart[OutputT, StateT]]: ...
) -> Iterator[StreamPart[StateT, OutputT]]: ...
@overload
def stream(
@@ -2787,7 +2787,7 @@ class Pregel(
debug: bool | None = None,
version: Literal["v2"],
**kwargs: Unpack[DeprecatedKwargs],
) -> AsyncIterator[StreamPart[OutputT, StateT]]: ...
) -> AsyncIterator[StreamPart[StateT, OutputT]]: ...
@overload
def astream(
@@ -3194,7 +3194,7 @@ class Pregel(
durability: Durability | None = None,
version: Literal["v2"],
**kwargs: Any,
) -> list[StreamPart[OutputT, StateT]]: ...
) -> list[StreamPart[StateT, OutputT]]: ...
@overload
def invoke(
@@ -3364,7 +3364,7 @@ class Pregel(
durability: Durability | None = None,
version: Literal["v2"],
**kwargs: Any,
) -> list[StreamPart[OutputT, StateT]]: ...
) -> list[StreamPart[StateT, OutputT]]: ...
@overload
async def ainvoke(
+2 -2
View File
@@ -117,7 +117,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, ContextT, InputT, Ou
interrupt_after: All | Sequence[str] | None = None,
subgraphs: bool = False,
version: Literal["v2"],
) -> Iterator[StreamPart[OutputT, StateT]]: ...
) -> Iterator[StreamPart[StateT, OutputT]]: ...
@overload
@abstractmethod
@@ -161,7 +161,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, ContextT, InputT, Ou
interrupt_after: All | Sequence[str] | None = None,
subgraphs: bool = False,
version: Literal["v2"],
) -> AsyncIterator[StreamPart[OutputT, StateT]]: ...
) -> AsyncIterator[StreamPart[StateT, OutputT]]: ...
@overload
@abstractmethod
+1 -1
View File
@@ -335,7 +335,7 @@ StreamPart = TypeAliasType(
| CheckpointStreamPart[StateT]
| TasksStreamPart
| DebugStreamPart[StateT],
type_params=(OutputT, StateT),
type_params=(StateT, OutputT),
)
"""A discriminated union of all v2 stream part types.
+1 -1
View File
@@ -1129,7 +1129,7 @@ _OutputT = TypeVar("_OutputT")
_StateT = TypeVar("_StateT")
def _check_type_narrowing(part: StreamPart[_OutputT, _StateT]) -> None:
def _check_type_narrowing(part: StreamPart[_StateT, _OutputT]) -> None:
"""Compile-time type narrowing checks — never called at runtime."""
if part["type"] == "values":
assert_type(part, ValuesStreamPart[_OutputT])