From c6b67d6267b5a67ef2f2dbac3cf09921c7440d48 Mon Sep 17 00:00:00 2001 From: Nishant Khandhar Date: Tue, 18 Aug 2026 15:15:57 -0500 Subject: [PATCH] fix(client-python): import NotRequired from typing_extensions for 3.10 support The package declares requires-python >=3.10 and ships the 3.10 trove classifier, but types/billing.py and types/client.py both import NotRequired directly from typing, which only gained it in Python 3.11 (PEP 655). On 3.10, `import rocketride` fails outright: ImportError: cannot import name 'NotRequired' from 'typing' client.py is imported before billing.py in types/__init__.py, so the failure surfaces there first - fixing billing.py alone would not have resolved the reported error. Import NotRequired from typing_extensions in both files instead, and add typing_extensions as an explicit dependency (it was previously only present transitively via pydantic, so not something this package declared or controlled). Verified on real interpreters, not just by reading the code: python3.10 -c "...; import rocketride" # ImportError before, OK after python3.11 -c "...; import rocketride" # OK before and after Ran the full client-python test suite before and after: 48 failed / 52 passed / 6 skipped / 21 errors in both cases (the failures are pre-existing integration tests that need a live RocketRide engine connection - unrelated to this change, confirmed identical on a clean checkout). Fixes #1820 --- packages/client-python/pyproject.toml | 1 + packages/client-python/src/rocketride/types/billing.py | 4 +++- packages/client-python/src/rocketride/types/client.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/client-python/pyproject.toml b/packages/client-python/pyproject.toml index c2a31a2fe..6b69b28bc 100644 --- a/packages/client-python/pyproject.toml +++ b/packages/client-python/pyproject.toml @@ -41,6 +41,7 @@ dependencies = [ "websockets>=11.0.0", "aiofiles>=23.0.0", "pydantic>=2.0.0", + "typing_extensions>=4.0.0", ] requires-python = ">=3.10" license = "MIT" diff --git a/packages/client-python/src/rocketride/types/billing.py b/packages/client-python/src/rocketride/types/billing.py index 55dfcf707..df5838069 100644 --- a/packages/client-python/src/rocketride/types/billing.py +++ b/packages/client-python/src/rocketride/types/billing.py @@ -36,7 +36,9 @@ PromoRedemption: Result of redeeming a credit-grant code. """ -from typing import Literal, NotRequired, TypedDict +from typing import Literal, TypedDict + +from typing_extensions import NotRequired # ============================================================================= diff --git a/packages/client-python/src/rocketride/types/client.py b/packages/client-python/src/rocketride/types/client.py index 8d69a651e..7eb8a37e3 100644 --- a/packages/client-python/src/rocketride/types/client.py +++ b/packages/client-python/src/rocketride/types/client.py @@ -55,7 +55,9 @@ async def handle_event(event: DAPMessage) -> None: print(f"Event: {event['event']}") """ -from typing import Any, Callable, Awaitable, NotRequired, TypedDict, Literal, Optional, Union +from typing import Any, Callable, Awaitable, TypedDict, Literal, Optional, Union + +from typing_extensions import NotRequired class TraceInfo(TypedDict):