Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-langchain-core for
openSUSE:Factory checked in at 2026-11-17 17:18:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-langchain-core (Old)
and /work/SRC/openSUSE:Factory/.python-langchain-core.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-langchain-core"
Tue Nov 17 17:18:34 2026 rev:29 rq:1398006 version:1.8.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-langchain-core/python-langchain-core.changes
2026-11-13 18:31:51.620482514 +0100
+++
/work/SRC/openSUSE:Factory/.python-langchain-core.new.1251/python-langchain-core.changes
2026-11-17 17:20:23.721604638 +0100
@@ -1,0 +2,9 @@
+Mon Nov 16 20:32:56 UTC 2026 - Martin Pluskal <[email protected]>
+
+- Update to 1.8.1:
+ * Add `langsmith_gateway` context manager for per-context
+ LangSmith gateway routing; chat models built inside it go
+ through the gateway per request instead of the
+ LANGSMITH_GATEWAY env var.
+
+-------------------------------------------------------------------
Old:
----
langchain_core-1.8.0.tar.gz
New:
----
langchain_core-1.8.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-langchain-core.spec ++++++
--- /var/tmp/diff_new_pack.QCHWjX/_old 2026-11-17 17:20:25.052660822 +0100
+++ /var/tmp/diff_new_pack.QCHWjX/_new 2026-11-17 17:20:25.053660864 +0100
@@ -17,7 +17,7 @@
Name: python-langchain-core
-Version: 1.8.0
+Version: 1.8.1
Release: 0
Summary: Building applications with LLMs through composability
License: MIT
@@ -107,7 +107,7 @@
# and already fails on slower OBS i586 workers (same fail on devel 1.5.6).
%pytest tests/unit_tests --ignore
tests/unit_tests/indexing/test_in_memory_indexer.py --ignore
tests/unit_tests/language_models/test_compat_bridge.py --ignore
tests/unit_tests/stores/test_in_memory.py --ignore
tests/unit_tests/vectorstores/test_in_memory.py --ignore
tests/unit_tests/test_ssrf_policy_transport.py --deselect
tests/unit_tests/runnables/test_graph.py::test_graph_single_runnable --deselect
tests/unit_tests/runnables/test_graph.py::test_graph_sequence --deselect
tests/unit_tests/runnables/test_graph.py::test_graph_sequence_map --deselect
tests/unit_tests/test_ssrf_protection.py::TestValidateSafeUrl::test_valid_public_https_url
--deselect
tests/unit_tests/test_ssrf_protection.py::TestValidateSafeUrl::test_valid_public_http_url
--deselect
tests/unit_tests/test_ssrf_protection.py::TestValidateSafeUrl::test_https_only_mode
--deselect
tests/unit_tests/test_ssrf_protection.py::TestIsSafeUrl::test_safe_url_returns_true
--deselect tests/unit_tests/test_ssrf_protection.py::TestSSR
FProtectedUrlType::test_valid_url_accepted --deselect
tests/unit_tests/test_ssrf_protection.py::TestRealWorldURLs::test_slack_webhook
--deselect
tests/unit_tests/test_ssrf_protection.py::TestRealWorldURLs::test_discord_webhook
--deselect
tests/unit_tests/test_ssrf_protection.py::TestRealWorldURLs::test_webhook_site
--deselect
tests/unit_tests/test_ssrf_protection.py::TestRealWorldURLs::test_ngrok_url
--deselect
tests/unit_tests/language_models/chat_models/test_benchmark.py::test_benchmark_model
--deselect tests/unit_tests/utils/test_uuid_utils.py::test_uuid7 --deselect
tests/unit_tests/runnables/test_tracing_interops.py::test_config_traceable_handoff
--deselect
tests/unit_tests/runnables/test_tracing_interops.py::test_config_traceable_async_handoff
--deselect
"tests/unit_tests/runnables/test_tracing_interops.py::test_tree_is_constructed[ls]"
--deselect
"tests/unit_tests/runnables/test_tracing_interops.py::test_tree_is_constructed[lc]"
--deselect tests/unit_tests/runnables/test_traci
ng_interops.py::test_traceable_parent_run_map_cleanup --deselect
tests/unit_tests/runnables/test_tracing_interops.py::test_traceable_parent_run_map_cleanup_with_sibling_children
--deselect
tests/unit_tests/runnables/test_tracing_interops.py::test_traceable_parent_run_map_no_runttree_accumulation
--deselect
tests/unit_tests/runnables/test_tracing_interops.py::TestLangsmithInheritableTracingDefaultsInConfigure::test_inheritable_metadata_concurrent_invocations_remain_isolated
--deselect
"tests/unit_tests/tracers/test_address.py::test_ambient_destination[parent-destination0]"
--deselect
"tests/unit_tests/tracers/test_address.py::test_ambient_destination[parent-destination1]"
--deselect
tests/unit_tests/tracers/test_address.py::test_parent_destination_overrides_tracer
--deselect
"tests/unit_tests/tracers/test_address.py::test_tracer_kwargs_parent_destination[destination0]"
--deselect
"tests/unit_tests/tracers/test_address.py::test_tracer_kwargs_parent_destination[destination1]"
--deselec
t
tests/unit_tests/tracers/test_address.py::test_addressed_parent_replica_inherited_outside_context
--deselect
tests/unit_tests/tracers/test_base_tracer.py::test_traceable_to_tracing
--deselect
tests/unit_tests/tracers/test_langchain.py::test_tracer_with_run_tree_parent
-%files %python_files
+%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/langchain_core
++++++ langchain_core-1.8.0.tar.gz -> langchain_core-1.8.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_core-1.8.0/PKG-INFO
new/langchain_core-1.8.1/PKG-INFO
--- old/langchain_core-1.8.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_core-1.8.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.5
Name: langchain-core
-Version: 1.8.0
+Version: 1.8.1
Summary: Building applications with LLMs through composability
Project-URL: Homepage, https://docs.langchain.com/
Project-URL: Documentation,
https://reference.langchain.com/python/langchain_core/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/langchain_core-1.8.0/langchain_core/utils/_gateway.py
new/langchain_core-1.8.1/langchain_core/utils/_gateway.py
--- old/langchain_core-1.8.0/langchain_core/utils/_gateway.py 2020-02-02
01:00:00.000000000 +0100
+++ new/langchain_core-1.8.1/langchain_core/utils/_gateway.py 2020-02-02
01:00:00.000000000 +0100
@@ -13,12 +13,15 @@
import json
import os
from collections.abc import Mapping
+from contextlib import contextmanager
+from contextvars import ContextVar
from typing import TYPE_CHECKING, Any, NamedTuple
+from urllib.parse import urlsplit
from pydantic import SecretStr
if TYPE_CHECKING:
- from collections.abc import Sequence
+ from collections.abc import Iterator, Sequence
from pydantic import BaseModel
@@ -37,6 +40,80 @@
_LANGSMITH_API_KEY_ENV = "LANGSMITH_API_KEY"
_LANGSMITH_GATEWAY_DEFAULT_BASE = "https://gateway.smith.langchain.com"
+
+class _GatewayOverride(NamedTuple):
+ """Gateway settings set for the current context by `langsmith_gateway`."""
+
+ base_url: str
+ api_key: SecretStr
+
+
+_GATEWAY_OVERRIDE: ContextVar[_GatewayOverride | None] = ContextVar(
+ "langchain_gateway_override", default=None
+)
+
+
+@contextmanager
+def langsmith_gateway(
+ *,
+ api_key: str | SecretStr,
+ base_url: str = _LANGSMITH_GATEWAY_DEFAULT_BASE,
+) -> Iterator[None]:
+ """Route chat models built in this context through the LangSmith gateway.
+
+ Unlike the `LANGSMITH_GATEWAY` env var, which applies to the whole process,
+ this applies only to the current context (thread or asyncio task), so a
+ server can route some requests through the gateway and not others.
+
+ The gateway is resolved when a model is constructed, so wrap construction
+ (for example `load()` of a serialized model), not invocation.
+
+ While the context is active, the gateway URL and key take precedence over
+ any base URL or API key passed to the model or set in the environment. This
+ lets a caller load an untrusted serialized model without it redirecting the
+ gateway key to another host or bypassing the gateway.
+
+ Args:
+ api_key: Key used to authenticate to the gateway.
+ base_url: Gateway host. The provider's path is appended per model.
+
+ Yields:
+ None.
+
+ Raises:
+ ValueError: If `api_key` is empty or `base_url` is not an http(s) URL.
+ """
+ secret = api_key if isinstance(api_key, SecretStr) else SecretStr(api_key)
+ if not secret.get_secret_value():
+ msg = "A gateway API key is required."
+ raise ValueError(msg)
+ parsed = urlsplit(base_url)
+ if parsed.scheme not in {"http", "https"} or not parsed.netloc:
+ msg = f"Invalid gateway base URL: {base_url!r}"
+ raise ValueError(msg)
+ token = _GATEWAY_OVERRIDE.set(_GatewayOverride(base_url.rstrip("/"),
secret))
+ try:
+ yield
+ finally:
+ _GATEWAY_OVERRIDE.reset(token)
+
+
+def _override_base_url(
+ override: _GatewayOverride, base_url: str | None, provider_path: str
+) -> str:
+ """Return the base URL to use while a `langsmith_gateway` context is
active.
+
+ An explicit `base_url` is kept only when it is already under the context's
+ gateway host, so a caller that resolved a different gateway path (e.g.
+ `init_chat_model`'s `langsmith` provider uses `/v1`) keeps it. Anything
else
+ is replaced with the provider path on the gateway, so a model cannot send
+ the gateway key to another host.
+ """
+ if isinstance(base_url, str) and
base_url.startswith(f"{override.base_url}/"):
+ return base_url
+ return f"{override.base_url}/{provider_path}"
+
+
_TRUE_VALUES = ("true", "1", "yes")
_FALSE_VALUES = ("false", "0", "no")
@@ -92,6 +169,9 @@
The provider base URL on the gateway, or None if the gateway is
disabled.
"""
+ override = _GATEWAY_OVERRIDE.get()
+ if override is not None:
+ return _override_base_url(override, None, provider_path)
raw = os.getenv(_LANGSMITH_GATEWAY_ENV)
if not raw or raw.lower() in _FALSE_VALUES:
return None
@@ -114,7 +194,10 @@
) -> GatewayConfig:
"""Resolve a provider's base URL and API key, applying gateway settings.
- Precedence:
+ Inside `langsmith_gateway`, the context's gateway key is returned, and the
+ base URL is the provider path on the gateway host (an explicit `base_url`
+ already on that host is kept). Everything below is ignored. Otherwise,
+ precedence is:
- **base_url:** explicit ``base_url`` > ``base_url_env`` > LangSmith
gateway
> ``default_base_url``.
@@ -145,6 +228,14 @@
Returns:
The resolved `GatewayConfig`.
"""
+ override = _GATEWAY_OVERRIDE.get()
+ if override is not None:
+ return GatewayConfig(
+ base_url=_override_base_url(override, base_url, provider_path),
+ api_key=override.api_key,
+ base_url_from_gateway=True,
+ )
+
gateway_base_url = _resolve_gateway_base_url(provider_path)
resolved_base_url = base_url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_core-1.8.0/langchain_core/version.py
new/langchain_core-1.8.1/langchain_core/version.py
--- old/langchain_core-1.8.0/langchain_core/version.py 2020-02-02
01:00:00.000000000 +0100
+++ new/langchain_core-1.8.1/langchain_core/version.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,3 +1,3 @@
"""Version information for `langchain-core`."""
-VERSION = "1.8.0"
+VERSION = "1.8.1"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_core-1.8.0/pyproject.toml
new/langchain_core-1.8.1/pyproject.toml
--- old/langchain_core-1.8.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/langchain_core-1.8.1/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -20,7 +20,7 @@
"Topic :: Software Development :: Libraries :: Python Modules",
]
-version = "1.8.0"
+version = "1.8.1"
requires-python = ">=3.11.0,<4.0.0"
dependencies = [
"langsmith>=0.14.9,<1.0.0",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/langchain_core-1.8.0/tests/unit_tests/utils/test_gateway.py
new/langchain_core-1.8.1/tests/unit_tests/utils/test_gateway.py
--- old/langchain_core-1.8.0/tests/unit_tests/utils/test_gateway.py
2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_core-1.8.1/tests/unit_tests/utils/test_gateway.py
2020-02-02 01:00:00.000000000 +0100
@@ -1,5 +1,6 @@
"""Tests for LangSmith gateway configuration resolution."""
+import asyncio
from typing import Any
import pytest
@@ -11,6 +12,7 @@
_parse_gateway_metadata,
_resolve_gateway_base_url,
_resolve_gateway_config,
+ langsmith_gateway,
)
# A representative provider path; the helper is provider-agnostic.
@@ -331,3 +333,123 @@
def test_parse_gateway_metadata_non_json() -> None:
headers = {"X-LangSmith-Gateway-Metadata": "not-json"}
assert _parse_gateway_metadata(headers) is None
+
+
+# --- langsmith_gateway ------------------------------------------------------
+
+
+def test_context_routes_to_gateway() -> None:
+ with langsmith_gateway(api_key="ctx-key"):
+ config = _config()
+ assert _resolve_gateway_base_url(_PATH) == _DEFAULT_GATEWAY
+ assert config.base_url == _DEFAULT_GATEWAY
+ assert isinstance(config.api_key, SecretStr)
+ assert config.api_key.get_secret_value() == "ctx-key"
+ assert config.base_url_from_gateway is True
+
+
+def test_context_custom_base_url_strips_trailing_slash() -> None:
+ with langsmith_gateway(api_key="ctx-key",
base_url="https://gw.example.com/"):
+ assert _config().base_url == "https://gw.example.com/openai/v1"
+
+
+def test_context_overrides_explicit_and_env(monkeypatch: pytest.MonkeyPatch)
-> None:
+ monkeypatch.setenv(_BASE_ENV, "https://env.example.com")
+ monkeypatch.setenv(_KEY_ENV, "env-key")
+ monkeypatch.setenv("LANGSMITH_GATEWAY",
"https://other-gateway.example.com")
+ monkeypatch.setenv("LANGSMITH_GATEWAY_API_KEY", "env-gateway-key")
+ with langsmith_gateway(api_key=SecretStr("ctx-key")):
+ config = _config(base_url="https://attacker.example.com",
api_key="user-key")
+ assert config.base_url == _DEFAULT_GATEWAY
+ assert config.api_key.get_secret_value() == "ctx-key"
+
+
+def test_context_resets_on_exit_and_error() -> None:
+ with langsmith_gateway(api_key="ctx-key"):
+ pass
+ assert _config().base_url is None
+ with pytest.raises(RuntimeError), langsmith_gateway(api_key="ctx-key"):
+ raise RuntimeError
+ assert _config().base_url is None
+
+
+def test_context_nesting_restores_outer() -> None:
+ with langsmith_gateway(api_key="outer",
base_url="https://outer.example.com"):
+ with langsmith_gateway(api_key="inner",
base_url="https://inner.example.com"):
+ assert _config().api_key.get_secret_value() == "inner"
+ assert _config().base_url == "https://outer.example.com/openai/v1"
+
+
[email protected]("api_key", ["", SecretStr("")])
+def test_context_rejects_empty_key(api_key: str | SecretStr) -> None:
+ with pytest.raises(ValueError, match="API key"),
langsmith_gateway(api_key=api_key):
+ pass
+
+
[email protected](
+ "base_url", ["gateway.example.com", "ftp://gw.example.com", "https://", ""]
+)
+def test_context_rejects_invalid_base_url(base_url: str) -> None:
+ with (
+ pytest.raises(ValueError, match="base URL"),
+ langsmith_gateway(api_key="k", base_url=base_url),
+ ):
+ pass
+
+
+async def test_context_isolated_between_tasks() -> None:
+ async def resolve() -> str | None:
+ return _config().base_url
+
+ with langsmith_gateway(api_key="ctx-key"):
+ inside = asyncio.create_task(resolve())
+ assert await inside == _DEFAULT_GATEWAY
+ outside = asyncio.create_task(resolve())
+ assert await outside is None
+
+
+def test_context_applies_to_model_fields() -> None:
+ class _Model(BaseModel):
+ model_config = ConfigDict(populate_by_name=True)
+ api_base: str | None = Field(default=None, alias="base_url")
+ api_key: SecretStr | None = None
+
+ values: dict[str, Any] = {
+ "base_url": "https://attacker.example.com",
+ "api_key": "k",
+ }
+ with langsmith_gateway(api_key="ctx-key"):
+ _apply_gateway_config(
+ values,
+ _Model,
+ base_url_field="api_base",
+ api_key_field="api_key",
+ provider_path=_PATH,
+ )
+ model = _Model(**values)
+ assert model.api_base == _DEFAULT_GATEWAY
+ assert model.api_key is not None
+ assert model.api_key.get_secret_value() == "ctx-key"
+
+
+def test_context_keeps_explicit_url_on_gateway_host() -> None:
+ """A base URL already on the gateway host keeps its path (e.g. `/v1`)."""
+ gateway_v1 = "https://gateway.smith.langchain.com/v1"
+ with langsmith_gateway(api_key="ctx-key"):
+ config = _config(base_url=gateway_v1, api_key="user-key")
+ assert config.base_url == gateway_v1
+ assert config.api_key.get_secret_value() == "ctx-key"
+
+
[email protected](
+ "base_url",
+ [
+ "https://gateway.smith.langchain.com.evil.com/v1",
+ "https://[email protected]/v1",
+ "https://gateway.smith.langchain.com",
+ ],
+)
+def test_context_replaces_lookalike_gateway_url(base_url: str) -> None:
+ with langsmith_gateway(api_key="ctx-key"):
+ config = _config(base_url=base_url)
+ assert config.base_url == _DEFAULT_GATEWAY
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/langchain_core-1.8.0/uv.lock
new/langchain_core-1.8.1/uv.lock
--- old/langchain_core-1.8.0/uv.lock 2020-02-02 01:00:00.000000000 +0100
+++ new/langchain_core-1.8.1/uv.lock 2020-02-02 01:00:00.000000000 +0100
@@ -6,7 +6,8 @@
"python_full_version == '3.14.*'",
"python_full_version == '3.13.*'",
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
- "python_full_version < '3.12' or (python_full_version == '3.12.*' and
sys_platform != 'emscripten')",
+ "(python_full_version >= '3.11.5' and python_full_version < '3.12') or
(python_full_version == '3.12.*' and sys_platform != 'emscripten')",
+ "python_full_version < '3.11.5'",
]
[manifest]
@@ -204,8 +205,27 @@
[[package]]
name = "beautifulsoup4"
+version = "4.6.3"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11.5'",
+]
+sdist = { url =
"https://files.pythonhosted.org/packages/88/df/86bffad6309f74f3ff85ea69344a078fc30003270c8df6894fca7a3c72ff/beautifulsoup4-4.6.3.tar.gz",
hash =
"sha256:90f8e61121d6ae58362ce3bed8cd997efb00c914eae0ff3d363c32f9a9822d10", size
= 167469, upload-time = "2018-08-12T16:39:49.655Z" }
+wheels = [
+ { url =
"https://files.pythonhosted.org/packages/21/0a/47fdf541c97fd9b6a610cb5fd518175308a7cc60569962e776ac52420387/beautifulsoup4-4.6.3-py3-none-any.whl",
hash =
"sha256:194ec62a25438adcb3fdb06378b26559eda1ea8a747367d34c33cef9c7f48d57", size
= 90375, upload-time = "2018-08-12T16:39:48.02Z" },
+]
+
+[[package]]
+name = "beautifulsoup4"
version = "4.14.3"
source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.15'",
+ "python_full_version == '3.14.*'",
+ "python_full_version == '3.13.*'",
+ "python_full_version == '3.12.*' and sys_platform == 'emscripten'",
+ "(python_full_version >= '3.11.5' and python_full_version < '3.12') or
(python_full_version == '3.12.*' and sys_platform != 'emscripten')",
+]
dependencies = [
{ name = "soupsieve" },
{ name = "typing-extensions" },
@@ -1021,7 +1041,7 @@
[[package]]
name = "langchain-core"
-version = "1.8.0"
+version = "1.8.1"
source = { editable = "." }
dependencies = [
{ name = "certifi" },
@@ -1570,7 +1590,8 @@
version = "7.17.2"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "beautifulsoup4" },
+ { name = "beautifulsoup4", version = "4.6.3", source = { registry =
"https://pypi.org/simple" }, marker = "python_full_version < '3.11.5'" },
+ { name = "beautifulsoup4", version = "4.14.3", source = { registry =
"https://pypi.org/simple" }, marker = "python_full_version >= '3.11.5'" },
{ name = "bleach", extra = ["css"] },
{ name = "defusedxml" },
{ name = "jinja2" },
@@ -2664,11 +2685,11 @@
[[package]]
name = "soupsieve"
-version = "2.9"
+version = "4.1"
source = { registry = "https://pypi.org/simple" }
-sdist = { url =
"https://files.pythonhosted.org/packages/80/f1/93422647dd7e461f23d254e6b2bfa687a85b53aeb4903fcdbb74474d4584/soupsieve-2.9.tar.gz",
hash =
"sha256:acee8417325c5653e1377dc31eccad59eb82cbc65942afe6174c53b3aaad63fc", size
= 122122, upload-time = "2026-07-19T01:35:18.425Z" }
+sdist = { url =
"https://files.pythonhosted.org/packages/95/48/21a393ff731b8f928fa4f8176f9a7ceba2252ee60a5149f25b45c292aa5c/soupsieve-4.1.tar.gz",
hash =
"sha256:ca9abf7126667010d8f6e9b39bfc1bc3b23c8aed9bcb0f54a754dde969bb8aab", size
= 161955, upload-time = "2026-11-10T01:59:50.399Z" }
wheels = [
- { url =
"https://files.pythonhosted.org/packages/7b/d6/3185ab5ad1280319b31986898f3206dd7227cd75e293d4dba2a5e6bf27a0/soupsieve-2.9-py3-none-any.whl",
hash =
"sha256:a2b2c76d67df2382d245409fd71e321a571717e58463efa32ace87dcadac2c12", size
= 37387, upload-time = "2026-07-19T01:35:17.106Z" },
+ { url =
"https://files.pythonhosted.org/packages/88/73/6a2087c72975cfc07394623bca8d17654342ea4055ae368deafe5a81a542/soupsieve-4.1-py3-none-any.whl",
hash =
"sha256:e4d667b3974ce6e038e7390486b8093369854a1d345ffdd4c121dfc4a782e809", size
= 52302, upload-time = "2026-11-10T01:59:48.571Z" },
]
[[package]]