mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
fix: use conditional import for NotRequired to support Python 3.11+
Fixes #124 The issue was that `typing_extensions.NotRequired` was always imported, but the dependency only installed typing_extensions for Python < 3.11. In Python 3.11+, NotRequired is available in the standard typing module. Changes: - Added conditional import: use `typing.NotRequired` for Python 3.11+ - Falls back to `typing_extensions.NotRequired` for Python 3.10 - This eliminates the ModuleNotFoundError on Python 3.11+ environments 🤖 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
parent
53482d8955
commit
39acac79c8
1 changed files with 5 additions and 1 deletions
|
|
@ -6,7 +6,11 @@ from dataclasses import dataclass, field
|
|||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypedDict
|
||||
|
||||
from typing_extensions import NotRequired
|
||||
# NotRequired was added to typing in Python 3.11
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired
|
||||
else:
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mcp.server import Server as McpServer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue