Skip to content

Conversation

@harupy
Copy link
Contributor

@harupy harupy commented Nov 23, 2025

Summary

  • typing_extensions is only installed on Python < 3.11 (per pyproject.toml)
  • The current unconditional import from typing_extensions fails on Python 3.11+ where the package isn't installed
  • This PR uses a try/except to import from stdlib typing first, falling back to typing_extensions for older Python versions

Test plan

  • Verify tests pass on Python 3.11+
  • Verify tests pass on Python < 3.11

🤖 Generated with Claude Code

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 <[email protected]>
@harupy harupy changed the title fix: use conditional import for NotRequired to match dependency spec fix: use conditional import for NotRequired to match dependency spec Nov 23, 2025
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, TypedDict

from typing_extensions import NotRequired
Copy link
Contributor Author

@harupy harupy Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the mcp package (and many packages also) requries typing_extensions, this import actually doesn't fail even in Python >= 3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant