Compare commits

...
Author SHA1 Message Date
Sydney Runkle c18a642514 v06 ftw 2025-07-30 16:11:23 -04:00
Sydney RunkleandGitHub 2b4b3cb6f1 Merge branch 'main' into sr/fix-dep-warning 2025-07-30 16:10:40 -04:00
Sydney Runkle 3b76546101 use deprecated in v06 2025-07-30 15:50:02 -04:00
12 changed files with 49 additions and 41 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ from langgraph._internal._constants import (
CONFIG_KEY_CHECKPOINTER, CONFIG_KEY_CHECKPOINTER,
TASKS, TASKS,
) )
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
__all__ = ( __all__ = (
"TAG_NOSTREAM", "TAG_NOSTREAM",
@@ -36,7 +36,7 @@ def __getattr__(name: str) -> Any:
warn( warn(
f"Importing {name} from langgraph.constants is deprecated. " f"Importing {name} from langgraph.constants is deprecated. "
f"Please use 'from langgraph.types import {name}' instead.", f"Please use 'from langgraph.types import {name}' instead.",
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
@@ -54,7 +54,7 @@ def __getattr__(name: str) -> Any:
f"Importing {name} from langgraph.constants is deprecated. " f"Importing {name} from langgraph.constants is deprecated. "
f"This constant is now private and should not be used directly. " f"This constant is now private and should not be used directly. "
"Please let the LangGraph team know if you need this value.", "Please let the LangGraph team know if you need this value.",
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
return attr return attr
+2 -2
View File
@@ -10,7 +10,7 @@ from typing_extensions import deprecated
# EmptyChannelError is re-exported from langgraph.channels.base # EmptyChannelError is re-exported from langgraph.channels.base
from langgraph.checkpoint.base import EmptyChannelError # noqa: F401 from langgraph.checkpoint.base import EmptyChannelError # noqa: F401
from langgraph.types import Command, Interrupt from langgraph.types import Command, Interrupt
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
__all__ = ( __all__ = (
"EmptyChannelError", "EmptyChannelError",
@@ -102,7 +102,7 @@ class NodeInterrupt(GraphInterrupt):
def __init__(self, value: Any, id: str | None = None) -> None: def __init__(self, value: Any, id: str | None = None) -> None:
warn( warn(
"NodeInterrupt is deprecated. Please use `langgraph.types.interrupt` instead.", "NodeInterrupt is deprecated. Please use `langgraph.types.interrupt` instead.",
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
if id is None: if id is None:
+2 -2
View File
@@ -41,7 +41,7 @@ from langgraph.pregel._write import ChannelWrite, ChannelWriteEntry
from langgraph.store.base import BaseStore from langgraph.store.base import BaseStore
from langgraph.types import _DC_KWARGS, CachePolicy, RetryPolicy, StreamMode from langgraph.types import _DC_KWARGS, CachePolicy, RetryPolicy, StreamMode
from langgraph.typing import ContextT from langgraph.typing import ContextT
from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV06
__all__ = ("task", "entrypoint") __all__ = ("task", "entrypoint")
@@ -393,7 +393,7 @@ class entrypoint(Generic[ContextT]):
if (config_schema := kwargs.get("config_schema", MISSING)) is not MISSING: if (config_schema := kwargs.get("config_schema", MISSING)) is not MISSING:
warnings.warn( warnings.warn(
"`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", "`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
if context_schema is None: if context_schema is None:
+2 -2
View File
@@ -81,7 +81,7 @@ from langgraph.types import (
Send, Send,
) )
from langgraph.typing import ContextT, InputT, NodeInputT, OutputT, StateT from langgraph.typing import ContextT, InputT, NodeInputT, OutputT, StateT
from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV06
if sys.version_info < (3, 10): if sys.version_info < (3, 10):
NoneType = type(None) NoneType = type(None)
@@ -196,7 +196,7 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
if (config_schema := kwargs.get("config_schema", MISSING)) is not MISSING: if (config_schema := kwargs.get("config_schema", MISSING)) is not MISSING:
warnings.warn( warnings.warn(
"`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", "`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
if context_schema is None: if context_schema is None:
+7 -7
View File
@@ -131,7 +131,7 @@ from langgraph.types import (
StreamMode, StreamMode,
) )
from langgraph.typing import ContextT, InputT, OutputT, StateT from langgraph.typing import ContextT, InputT, OutputT, StateT
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
try: try:
from langchain_core.tracers._streaming import _StreamingCallbackHandler from langchain_core.tracers._streaming import _StreamingCallbackHandler
@@ -642,7 +642,7 @@ class Pregel(
) is not MISSING: ) is not MISSING:
warnings.warn( warnings.warn(
"`config_type` is deprecated and will be removed. Please use `context_schema` instead.", "`config_type` is deprecated and will be removed. Please use `context_schema` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
@@ -790,7 +790,7 @@ class Pregel(
def config_schema(self, *, include: Sequence[str] | None = None) -> type[BaseModel]: def config_schema(self, *, include: Sequence[str] | None = None) -> type[BaseModel]:
warnings.warn( warnings.warn(
"`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.", "`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
@@ -817,12 +817,12 @@ class Pregel(
) -> dict[str, Any]: ) -> dict[str, Any]:
warnings.warn( warnings.warn(
"`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.", "`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=LangGraphDeprecatedSinceV10) warnings.filterwarnings("ignore", category=LangGraphDeprecatedSinceV06)
schema = self.config_schema(include=include) schema = self.config_schema(include=include)
return schema.model_json_schema() return schema.model_json_schema()
@@ -2509,7 +2509,7 @@ class Pregel(
if deprecated_checkpoint_during is not None: if deprecated_checkpoint_during is not None:
warnings.warn( warnings.warn(
"`checkpoint_during` is deprecated and will be removed. Please use `durability` instead.", "`checkpoint_during` is deprecated and will be removed. Please use `durability` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
) )
# assign defaults # assign defaults
( (
@@ -2789,7 +2789,7 @@ class Pregel(
if deprecated_checkpoint_during is not None: if deprecated_checkpoint_during is not None:
warnings.warn( warnings.warn(
"`checkpoint_during` is deprecated and will be removed. Please use `durability` instead.", "`checkpoint_during` is deprecated and will be removed. Please use `durability` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
) )
# assign defaults # assign defaults
( (
+2 -2
View File
@@ -28,11 +28,11 @@ __all__ = [
from warnings import warn from warnings import warn
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
warn( warn(
"Importing from langgraph.pregel.types is deprecated. " "Importing from langgraph.pregel.types is deprecated. "
"Please use 'from langgraph.types import ...' instead.", "Please use 'from langgraph.types import ...' instead.",
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
+2 -2
View File
@@ -27,7 +27,7 @@ from langgraph._internal._fields import get_cached_annotated_keys, get_update_as
from langgraph._internal._retry import default_retry_on from langgraph._internal._retry import default_retry_on
from langgraph._internal._typing import MISSING, DeprecatedKwargs from langgraph._internal._typing import MISSING, DeprecatedKwargs
from langgraph.checkpoint.base import BaseCheckpointSaver, CheckpointMetadata from langgraph.checkpoint.base import BaseCheckpointSaver, CheckpointMetadata
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
if TYPE_CHECKING: if TYPE_CHECKING:
from langgraph.pregel.protocol import PregelProtocol from langgraph.pregel.protocol import PregelProtocol
@@ -198,7 +198,7 @@ class Interrupt:
def interrupt_id(self) -> str: def interrupt_id(self) -> str:
warn( warn(
"`interrupt_id` is deprecated. Use `id` instead.", "`interrupt_id` is deprecated. Use `id` instead.",
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
stacklevel=2, stacklevel=2,
) )
return self.id return self.id
+8
View File
@@ -5,6 +5,7 @@ from __future__ import annotations
__all__ = ( __all__ = (
"LangGraphDeprecationWarning", "LangGraphDeprecationWarning",
"LangGraphDeprecatedSinceV05", "LangGraphDeprecatedSinceV05",
"LangGraphDeprecatedSinceV06",
"LangGraphDeprecatedSinceV10", "LangGraphDeprecatedSinceV10",
) )
@@ -54,6 +55,13 @@ class LangGraphDeprecatedSinceV05(LangGraphDeprecationWarning):
super().__init__(message, *args, since=(0, 5), expected_removal=(2, 0)) super().__init__(message, *args, since=(0, 5), expected_removal=(2, 0))
class LangGraphDeprecatedSinceV06(LangGraphDeprecationWarning):
"""A specific `LangGraphDeprecationWarning` subclass defining functionality deprecated since LangGraph v0.6.0"""
def __init__(self, message: str, *args: object) -> None:
super().__init__(message, *args, since=(1, 0), expected_removal=(2, 0))
class LangGraphDeprecatedSinceV10(LangGraphDeprecationWarning): class LangGraphDeprecatedSinceV10(LangGraphDeprecationWarning):
"""A specific `LangGraphDeprecationWarning` subclass defining functionality deprecated since LangGraph v1.0.0""" """A specific `LangGraphDeprecationWarning` subclass defining functionality deprecated since LangGraph v1.0.0"""
+12 -12
View File
@@ -8,7 +8,7 @@ from langgraph.func import entrypoint, task
from langgraph.graph import StateGraph from langgraph.graph import StateGraph
from langgraph.pregel import NodeBuilder, Pregel from langgraph.pregel import NodeBuilder, Pregel
from langgraph.types import Interrupt, RetryPolicy from langgraph.types import Interrupt, RetryPolicy
from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV05, LangGraphDeprecatedSinceV06
class PlainState(TypedDict): ... class PlainState(TypedDict): ...
@@ -74,13 +74,13 @@ def test_add_node_input_schema() -> None:
def test_constants_deprecation() -> None: def test_constants_deprecation() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="Importing Send from langgraph.constants is deprecated. Please use 'from langgraph.types import Send' instead.", match="Importing Send from langgraph.constants is deprecated. Please use 'from langgraph.types import Send' instead.",
): ):
from langgraph.constants import Send # noqa: F401 from langgraph.constants import Send # noqa: F401
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="Importing Interrupt from langgraph.constants is deprecated. Please use 'from langgraph.types import Interrupt' instead.", match="Importing Interrupt from langgraph.constants is deprecated. Please use 'from langgraph.types import Interrupt' instead.",
): ):
from langgraph.constants import Interrupt # noqa: F401 from langgraph.constants import Interrupt # noqa: F401
@@ -88,7 +88,7 @@ def test_constants_deprecation() -> None:
def test_pregel_types_deprecation() -> None: def test_pregel_types_deprecation() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="Importing from langgraph.pregel.types is deprecated. Please use 'from langgraph.types import ...' instead.", match="Importing from langgraph.pregel.types is deprecated. Please use 'from langgraph.types import ...' instead.",
): ):
from langgraph.pregel.types import StateSnapshot # noqa: F401 from langgraph.pregel.types import StateSnapshot # noqa: F401
@@ -98,7 +98,7 @@ def test_pregel_types_deprecation() -> None:
@pytest.mark.filterwarnings("ignore:`get_config_jsonschema` is deprecated") @pytest.mark.filterwarnings("ignore:`get_config_jsonschema` is deprecated")
def test_config_schema_deprecation() -> None: def test_config_schema_deprecation() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
): ):
builder = StateGraph(PlainState, config_schema=PlainState) builder = StateGraph(PlainState, config_schema=PlainState)
@@ -109,13 +109,13 @@ def test_config_schema_deprecation() -> None:
graph = builder.compile() graph = builder.compile()
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.", match="`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.",
): ):
assert graph.config_schema() is not None assert graph.config_schema() is not None
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.", match="`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.",
): ):
graph.get_config_jsonschema() graph.get_config_jsonschema()
@@ -124,7 +124,7 @@ def test_config_schema_deprecation() -> None:
@pytest.mark.filterwarnings("ignore:`config_schema` is deprecated") @pytest.mark.filterwarnings("ignore:`config_schema` is deprecated")
def test_config_schema_deprecation_on_entrypoint() -> None: def test_config_schema_deprecation_on_entrypoint() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
): ):
@@ -141,7 +141,7 @@ def test_config_type_deprecation_pregel(mocker: MockerFixture) -> None:
chain = NodeBuilder().subscribe_only("input").do(add_one).write_to("output") chain = NodeBuilder().subscribe_only("input").do(add_one).write_to("output")
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_type` is deprecated and will be removed. Please use `context_schema` instead.", match="`config_type` is deprecated and will be removed. Please use `context_schema` instead.",
): ):
instance = Pregel( instance = Pregel(
@@ -164,7 +164,7 @@ def test_interrupt_attributes_deprecation() -> None:
interrupt = Interrupt(value="question", id="abc") interrupt = Interrupt(value="question", id="abc")
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`interrupt_id` is deprecated. Use `id` instead.", match="`interrupt_id` is deprecated. Use `id` instead.",
): ):
interrupt.interrupt_id interrupt.interrupt_id
@@ -173,7 +173,7 @@ def test_interrupt_attributes_deprecation() -> None:
@pytest.mark.filterwarnings("ignore:NodeInterrupt is deprecated.") @pytest.mark.filterwarnings("ignore:NodeInterrupt is deprecated.")
def test_node_interrupt_deprecation() -> None: def test_node_interrupt_deprecation() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="NodeInterrupt is deprecated. Please use `langgraph.types.interrupt` instead.", match="NodeInterrupt is deprecated. Please use `langgraph.types.interrupt` instead.",
): ):
NodeInterrupt(value="test") NodeInterrupt(value="test")
@@ -181,7 +181,7 @@ def test_node_interrupt_deprecation() -> None:
def test_deprecated_import() -> None: def test_deprecated_import() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="Importing PREVIOUS from langgraph.constants is deprecated. This constant is now private and should not be used directly.", match="Importing PREVIOUS from langgraph.constants is deprecated. This constant is now private and should not be used directly.",
): ):
from langgraph.constants import PREVIOUS # noqa: F401 from langgraph.constants import PREVIOUS # noqa: F401
@@ -4,13 +4,13 @@ import pytest
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
from langgraph.types import Interrupt from langgraph.types import Interrupt
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
@pytest.mark.filterwarnings("ignore:LangGraphDeprecatedSinceV10") @pytest.mark.filterwarnings("ignore:LangGraphDeprecatedSinceV06")
def test_interrupt_legacy_ns() -> None: def test_interrupt_legacy_ns() -> None:
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=LangGraphDeprecatedSinceV10) warnings.filterwarnings("ignore", category=LangGraphDeprecatedSinceV06)
old_interrupt = Interrupt( old_interrupt = Interrupt(
value="abc", resumable=True, when="during", ns=["a:b", "c:d"] value="abc", resumable=True, when="during", ns=["a:b", "c:d"]
@@ -49,7 +49,7 @@ from langgraph.runtime import Runtime
from langgraph.store.base import BaseStore from langgraph.store.base import BaseStore
from langgraph.types import Checkpointer, Send from langgraph.types import Checkpointer, Send
from langgraph.typing import ContextT from langgraph.typing import ContextT
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
StructuredResponse = Union[dict, BaseModel] StructuredResponse = Union[dict, BaseModel]
StructuredResponseSchema = Union[dict, type[BaseModel]] StructuredResponseSchema = Union[dict, type[BaseModel]]
@@ -460,7 +460,7 @@ def create_react_agent(
) is not MISSING: ) is not MISSING:
warn( warn(
"`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", "`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
category=LangGraphDeprecatedSinceV10, category=LangGraphDeprecatedSinceV06,
) )
if context_schema is None: if context_schema is None:
+4 -4
View File
@@ -2,7 +2,7 @@ import pytest
from typing_extensions import TypedDict from typing_extensions import TypedDict
from langgraph.prebuilt import create_react_agent from langgraph.prebuilt import create_react_agent
from langgraph.warnings import LangGraphDeprecatedSinceV10 from langgraph.warnings import LangGraphDeprecatedSinceV06
from tests.model import FakeToolCallingModel from tests.model import FakeToolCallingModel
@@ -14,20 +14,20 @@ class Config(TypedDict):
@pytest.mark.filterwarnings("ignore:`get_config_jsonschema` is deprecated") @pytest.mark.filterwarnings("ignore:`get_config_jsonschema` is deprecated")
def test_config_schema_deprecation() -> None: def test_config_schema_deprecation() -> None:
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.", match="`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
): ):
agent = create_react_agent(FakeToolCallingModel(), [], config_schema=Config) agent = create_react_agent(FakeToolCallingModel(), [], config_schema=Config)
assert agent.context_schema == Config assert agent.context_schema == Config
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.", match="`config_schema` is deprecated. Use `get_context_jsonschema` for the relevant schema instead.",
): ):
assert agent.config_schema() is not None assert agent.config_schema() is not None
with pytest.warns( with pytest.warns(
LangGraphDeprecatedSinceV10, LangGraphDeprecatedSinceV06,
match="`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.", match="`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.",
): ):
assert agent.get_config_jsonschema() is not None assert agent.get_config_jsonschema() is not None