fix(mcp): avoid eager YAML dependency import

This commit is contained in:
Sisyphus 2026-08-31 22:22:34 +08:00
parent 681554ca36
commit 3d5ca7ce3f
3 changed files with 3 additions and 4 deletions

View file

@ -13,7 +13,6 @@ from typing import Any, Final, TypedDict
from urllib.parse import quote
import httpx
import yaml
from typing_extensions import ReadOnly, Required
from litellm.llms.custom_httpx.http_handler import MaskedHTTPStatusError
@ -181,6 +180,8 @@ def _parse_openapi_spec(text: str) -> Mapping[str, Any]:
try:
parsed: Any = json.loads(text)
except json.JSONDecodeError:
import yaml
parsed = yaml.safe_load(text)
if not isinstance(parsed, dict):

View file

@ -123,7 +123,7 @@ utils = [
"numpydoc>=1.8.0,<2.0",
]
caching = ["diskcache>=5.6.3,<6.0"]
mcp = ["mcp>=2.2.0,<3", "httpx2>=2.5.0,<3", "pydantic>=2.12.0,<3", "pyyaml>=6.0.3,<7.0"]
mcp = ["mcp>=2.2.0,<3", "httpx2>=2.5.0,<3", "pydantic>=2.12.0,<3"]
# Driver for the MongoDB Atlas vector store; Atlas Vector Search has no HTTP query API.
# The floor is 4.9 because that is the release AsyncMongoClient landed in.
# SAML SSO for the admin UI. python3-saml pulls in xmlsec/lxml, whose wheels

2
uv.lock generated
View file

@ -4562,7 +4562,6 @@ mcp = [
{ name = "httpx2" },
{ name = "mcp" },
{ name = "pydantic" },
{ name = "pyyaml" },
]
mlflow = [
{ name = "mlflow" },
@ -4841,7 +4840,6 @@ requires-dist = [
{ name = "python3-saml", marker = "extra == 'saml'", specifier = ">=1.16.0,<2.0" },
{ name = "pyyaml", specifier = ">=6.0.3,<7.0" },
{ name = "pyyaml", marker = "extra == 'cli'", specifier = ">=6.0.3,<7.0" },
{ name = "pyyaml", marker = "extra == 'mcp'", specifier = ">=6.0.3,<7.0" },
{ name = "pyyaml", marker = "extra == 'proxy'", specifier = ">=6.0.3,<7.0" },
{ name = "redisvl", marker = "extra == 'extra-proxy'", specifier = ">=0.4.1,<1.0" },
{ name = "requests", marker = "extra == 'cli'", specifier = ">=2.32.0,<3.0" },