Deprecate classic hub entry points in favor of the LangSmith SDK.

Co-authored-by: Mason Daugherty <61371264+mdrxy@users.noreply.github.com>
This commit is contained in:
open-swe[bot]
2026-05-01 15:05:10 +00:00
parent 8640de8031
commit a83cc788c9
2 changed files with 47 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import json
from collections.abc import Sequence
from typing import Any, Literal
from langchain_core._api import deprecated
from langchain_core.load.dump import dumps
from langchain_core.load.load import loads
from langchain_core.prompts import BasePromptTemplate
@@ -52,6 +53,12 @@ def _get_client(
raise ImportError(msg) from e
@deprecated(
since="1.0.5",
alternative="langsmith.Client.push_prompt",
removal="2.0.0",
package="langchain-classic",
)
def push(
repo_full_name: str,
object: Any, # noqa: A002
@@ -108,6 +115,12 @@ def push(
)
@deprecated(
since="1.0.5",
alternative="langsmith.Client.pull_prompt",
removal="2.0.0",
package="langchain-classic",
)
def pull(
owner_repo_commit: str,
*,

View File

@@ -0,0 +1,34 @@
from typing import Any
import pytest
from langchain_core._api import LangChainDeprecationWarning
from langchain_classic import hub
class FakeLangSmithClient:
def pull_prompt(self, owner_repo_commit: str, **_: Any) -> str:
return owner_repo_commit
def push_prompt(self, repo_full_name: str, **_: Any) -> str:
return repo_full_name
def test_pull_warns_about_sdk_replacement(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(hub, "_get_client", lambda **_: FakeLangSmithClient())
with pytest.warns(
LangChainDeprecationWarning,
match="langsmith.Client.pull_prompt",
):
assert hub.pull("owner/prompt") == "owner/prompt"
def test_push_warns_about_sdk_replacement(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(hub, "_get_client", lambda **_: FakeLangSmithClient())
with pytest.warns(
LangChainDeprecationWarning,
match="langsmith.Client.push_prompt",
):
assert hub.push("owner/prompt", object={}) == "owner/prompt"