Skip to content

fix(client-python): import NotRequired from typing_extensions for 3.10 support - #2040

Open
nishant-k02 wants to merge 1 commit into
rocketride-org:developfrom
nishant-k02:fix/RR-1820-notrequired-py310-import
Open

fix(client-python): import NotRequired from typing_extensions for 3.10 support#2040
nishant-k02 wants to merge 1 commit into
rocketride-org:developfrom
nishant-k02:fix/RR-1820-notrequired-py310-import

Conversation

@nishant-k02

@nishant-k02 nishant-k02 commented Aug 18, 2026

Copy link
Copy Markdown

Description

Fixes #1820. packages/client-python/pyproject.toml declares requires-python = ">=3.10" and ships the Programming Language :: Python :: 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.

One correction to the issue as filed: it identifies billing.py as the sole offender ("Scope is exactly one file... billing.py holds all 17 NotRequired uses"). types/client.py has the same unconditional from typing import ..., NotRequired, ... (line 58, used at line 227 for developerId). Since types/__init__.py imports client before billing, the reported traceback actually surfaces in client.py first — fixing billing.py alone would not have resolved the reported error. Both files are fixed here.

Fix

  • from typing import ..., NotRequired, ... → split into a typing import (unaffected names) plus from typing_extensions import NotRequired, in both files.
  • Added typing_extensions>=4.0.0 to dependencies in pyproject.toml — it was previously only present transitively via pydantic, not something this package declared or controlled (matches the issue's own note on this).

Testing performed

Reproduced and verified against real interpreters, not just by reading the code:

# Before the fix
python3.10 -c "import sys; sys.path.insert(0,'packages/client-python/src'); import rocketride"
# ImportError: cannot import name 'NotRequired' from 'typing'

# After the fix
python3.10 -c "import sys; sys.path.insert(0,'packages/client-python/src'); import rocketride"
# OK

python3.11 -c "import sys; sys.path.insert(0,'packages/client-python/src'); import rocketride"
# OK (before and after — no regression on newer interpreters)

Also ran the full client-python test suite before and after this change:

48 failed, 52 passed, 6 skipped, 21 errors

Identical counts on both a clean develop checkout and this branch — the failures are pre-existing integration tests that require a live RocketRide engine connection, unrelated to this change.

Breaking changes

None. Adds one new direct dependency (typing_extensions) that was already present transitively via pydantic, so no new resolution constraint in practice.

Fixes #1820

Summary by CodeRabbit

  • Bug Fixes
    • Improved Python package compatibility across supported Python versions.
    • Resolved typing-related import issues affecting billing and client type definitions.

…0 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 rocketride-org#1820
@github-actions

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5ce6b2bf-a2a3-4432-90f8-be81968a3a30

📥 Commits

Reviewing files that changed from the base of the PR and between 310e135 and c6b67d6.

📒 Files selected for processing (3)
  • packages/client-python/pyproject.toml
  • packages/client-python/src/rocketride/types/billing.py
  • packages/client-python/src/rocketride/types/client.py

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The Python client adds typing_extensions as a runtime dependency and imports NotRequired from it in the billing and client type modules.

Changes

Python typing compatibility

Layer / File(s) Summary
Add typing compatibility dependency
packages/client-python/pyproject.toml, packages/client-python/src/rocketride/types/billing.py, packages/client-python/src/rocketride/types/client.py
The package adds typing_extensions>=4.0.0. The type modules import NotRequired from typing_extensions while retaining other standard typing imports.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to c6b67

The change makes the Python client importable on Python 3.10 by using the supported compatibility package and declaring it directly; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the import change and its Python 3.10 compatibility purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

module:client-python Python SDK and MCP client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(client-python): package declares requires-python >=3.10 but imports typing.NotRequired (3.11+), so import rocketride fails

1 participant