Skip to content

Commit 07edfb1

Browse files
fix: add type ignore and fix test_exceptions.py import
ROOT CAUSE: 1. tests/shared/test_exceptions.py still had old "from builtins" import 2. Missing # type: ignore[import-not-found] on exceptiongroup imports caused pyright errors CHANGES: - Fixed test_exceptions.py to use try/except import pattern - Added # type: ignore[import-not-found] to all exceptiongroup imports IMPACT: CI should now pass on all Python versions FILES MODIFIED: - tests/shared/test_exceptions.py - src/mcp/client/_memory.py - src/mcp/client/session_group.py - src/mcp/client/sse.py - src/mcp/client/stdio.py - src/mcp/client/streamable_http.py - src/mcp/client/websocket.py - src/mcp/server/sse.py - src/mcp/server/stdio.py - src/mcp/server/streamable_http_manager.py - src/mcp/server/streamable_http.py - src/mcp/server/websocket.py - src/mcp/shared/exceptions.py - src/mcp/server/lowlevel/server.py - src/mcp/server/experimental/task_support.py - src/mcp/server/experimental/task_result_handler.py
1 parent 8ff1ae2 commit 07edfb1

File tree

16 files changed

+20
-17
lines changed

16 files changed

+20
-17
lines changed

src/mcp/client/_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
try:
66
from builtins import BaseExceptionGroup
77
except ImportError:
8-
from exceptiongroup import BaseExceptionGroup
8+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
99
from collections.abc import AsyncIterator
1010
from contextlib import AbstractAsyncContextManager, asynccontextmanager
1111
from types import TracebackType

src/mcp/client/session_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
try:
1313
from builtins import BaseExceptionGroup
1414
except ImportError:
15-
from exceptiongroup import BaseExceptionGroup
15+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
1616
from collections.abc import Callable
1717
from dataclasses import dataclass
1818
from types import TracebackType

src/mcp/client/sse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
try:
44
from builtins import BaseExceptionGroup
55
except ImportError:
6-
from exceptiongroup import BaseExceptionGroup
6+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
77
from collections.abc import Callable
88
from contextlib import asynccontextmanager
99
from typing import Any

src/mcp/client/stdio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
try:
66
from builtins import BaseExceptionGroup
77
except ImportError:
8-
from exceptiongroup import BaseExceptionGroup
8+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
99
from contextlib import asynccontextmanager
1010
from pathlib import Path
1111
from typing import Literal, TextIO

src/mcp/client/streamable_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
try:
99
from builtins import BaseExceptionGroup
1010
except ImportError:
11-
from exceptiongroup import BaseExceptionGroup
11+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
1212
from collections.abc import AsyncGenerator, Awaitable, Callable
1313
from contextlib import asynccontextmanager
1414
from dataclasses import dataclass

src/mcp/client/websocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
try:
44
from builtins import BaseExceptionGroup
55
except ImportError:
6-
from exceptiongroup import BaseExceptionGroup
6+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
77
from collections.abc import AsyncGenerator
88
from contextlib import asynccontextmanager
99

src/mcp/server/experimental/task_result_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
try:
1515
from builtins import BaseExceptionGroup
1616
except ImportError:
17-
from exceptiongroup import BaseExceptionGroup
17+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
1818
from typing import Any
1919

2020
import anyio

src/mcp/server/experimental/task_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
try:
88
from builtins import BaseExceptionGroup
99
except ImportError:
10-
from exceptiongroup import BaseExceptionGroup
10+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
1111
from collections.abc import AsyncIterator
1212
from contextlib import asynccontextmanager
1313
from dataclasses import dataclass, field

src/mcp/server/lowlevel/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def main():
4343
try:
4444
from builtins import BaseExceptionGroup
4545
except ImportError:
46-
from exceptiongroup import BaseExceptionGroup
46+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
4747
from collections.abc import AsyncIterator, Awaitable, Callable
4848
from contextlib import AbstractAsyncContextManager, AsyncExitStack, asynccontextmanager
4949
from importlib.metadata import version as importlib_version

src/mcp/server/sse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def handle_sse(request):
4141
try:
4242
from builtins import BaseExceptionGroup
4343
except ImportError:
44-
from exceptiongroup import BaseExceptionGroup
44+
from exceptiongroup import BaseExceptionGroup # type: ignore[import-not-found]
4545
from contextlib import asynccontextmanager
4646
from typing import Any
4747
from urllib.parse import quote

0 commit comments

Comments
 (0)