Skip to content

fix(deps): declare typing_extensions and use stdlib NotRequired on 3.11+#693

Open
joerg84 wants to merge 2 commits into
mainfrom
fix/typing-extensions-690
Open

fix(deps): declare typing_extensions and use stdlib NotRequired on 3.11+#693
joerg84 wants to merge 2 commits into
mainfrom
fix/typing-extensions-690

Conversation

@joerg84

@joerg84 joerg84 commented Jul 17, 2026

Copy link
Copy Markdown

Problem

Clean installs on Python 3.13+/3.14 fail at import pinecone: _internal/indexes_helpers.py imports NotRequired from typing_extensions, which is not declared in [project] dependencies. It worked by accident — httpx → anyio only pulls typing_extensions on python_version < "3.13", and dev/CI environments always carry it via mypy. The unit-test matrix capping at 3.13 completed the blind spot.

Fix

  • Version-gate the import: stdlib typing.NotRequired on 3.11+, backport on 3.10.
  • Declare the real remaining dependency: typing_extensions>=4.0; python_version < '3.11'.
  • Add 3.14 to the unit-test matrix and the trove classifiers so a clean-install regression can't hide behind dev dependencies again.

Testing

  • Verified on a bare Python 3.14 venv with only httpx[http2], msgspec, orjson installed: pinecone._internal.indexes_helpers imports cleanly (fails with ModuleNotFoundError on main).
  • uv run pytest tests/unit: 4376 passed. (test_socket_options.py linux/darwin keepalive tests fail identically on clean main on macOS — pre-existing, untouched.)
  • ruff check, ruff format --check, mypy --strict clean on the touched file.

Fixes #690

Found by a cold-agent audit (2/2 bare-environment trials hit this on first import).

🤖 Generated with Claude Code


Note

Low Risk
Dependency and import-path fixes with narrow typing backport scope; test-only asyncio API changes; no runtime behavior change beyond fixing missing dependency on newer Python.

Overview
Fixes clean-install import failures on Python 3.13+ where indexes_helpers pulled NotRequired from typing_extensions without it being a declared runtime dependency.

NotRequired sourcing is version-gated in indexes_helpers.py: stdlib typing on 3.11+, typing_extensions only on 3.10. pyproject.toml adds typing_extensions>=4.0; python_version < '3.11', documents Python 3.14 in trove classifiers, and CI unit tests now include 3.14 in the matrix.

Unit tests that drove async coroutines via asyncio.get_event_loop().run_until_complete now use asyncio.run (batch and retry transport). uv.lock is refreshed (package version and dependency marker cleanup).

Reviewed by Cursor Bugbot for commit 18b4ae9. Bugbot is set up for automated code reviews on this repo. Configure here.

Clean installs on Python 3.13+/3.14 fail at import: indexes_helpers
imports NotRequired from typing_extensions, which was never declared
and only arrived transitively (httpx -> anyio, python_version < 3.13)
or via dev tooling. Gate the import (stdlib typing on 3.11+), declare
the backport for 3.10 only, and add 3.14 to the unit-test matrix so a
clean-install regression like this cannot hide behind dev dependencies.

Fixes #690

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joerg84
joerg84 requested a review from jhamon July 17, 2026 13:37
…r 3.14

Python 3.14 removed implicit event-loop creation from
asyncio.get_event_loop(), so the six sync test drivers using
get_event_loop().run_until_complete(...) now raise RuntimeError.
asyncio.run() is a drop-in here and works across the whole support
matrix. Caught by the new py3.14 CI job from this PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joerg84

joerg84 commented Jul 17, 2026

Copy link
Copy Markdown
Author

The new py3.14 matrix job immediately caught a real 3.14 incompatibility: six test drivers used asyncio.get_event_loop().run_until_complete(...), and 3.14 removed implicit loop creation from get_event_loop() (RuntimeError instead of a DeprecationWarning'd fresh loop). Pushed a commit replacing those six sites with asyncio.run(...) — product code had zero get_event_loop uses. Full unit suite verified locally on both 3.14 (4,599 passed) and 3.12.

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.

Clean install fails to import on Python 3.13+/3.14: typing_extensions is used but never declared

1 participant