From 1727167380aa8d3d97a7d672d7db0c6152a12cef Mon Sep 17 00:00:00 2001 From: harupy <17039389+harupy@users.noreply.github.com> Date: Sun, 23 Nov 2025 18:35:27 +0900 Subject: [PATCH] fix: use conditional import for NotRequired to match dependency spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit typing_extensions is only installed on Python < 3.11 (per pyproject.toml), so we need to try importing NotRequired from stdlib typing first, then fall back to typing_extensions for older Python versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/claude_agent_sdk/types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/claude_agent_sdk/types.py b/src/claude_agent_sdk/types.py index 81e19ac5..304949e6 100644 --- a/src/claude_agent_sdk/types.py +++ b/src/claude_agent_sdk/types.py @@ -6,7 +6,12 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Literal, TypedDict -from typing_extensions import NotRequired +try: + # Python >= 3.11 + from typing import NotRequired +except ImportError: + # Python < 3.11 + from typing_extensions import NotRequired if TYPE_CHECKING: from mcp.server import Server as McpServer