Import abstract base classes from collections.abc instead of typing#133
Merged
Conversation
Callable, Iterable, Iterator, Mapping, and Sequence have been deprecated as typing aliases since Python 3.9 (PEP 585). Move these imports to collections.abc across the SDK. All edits are import-only and behavior- preserving; PEP 585 makes the collections.abc forms subscriptable at runtime on Python 3.9+, matching the package's requires-python >=3.9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Callable,Iterable,Iterator,Mapping, andSequencehave been deprecated astypingaliases since Python 3.9 (PEP 585), with the canonical home beingcollections.abc. This PR moves those imports tocollections.abcacross the SDK.Files updated:
yutori/_async/chat.py—Iterableyutori/_sync/chat.py—Iterableyutori/navigator/loop.py—Iterableyutori/navigator/payload.py—Callableyutori/navigator/coordinates.py—Sequenceyutori/cli/commands/__init__.py—Iteratoryutori/cli/commands/install_flow.py—Mapping,Sequenceyutori/auth/flow.py—CallableSafety
collections.abcforms subscriptable at runtime since Python 3.9, matching the package'srequires-python = ">=3.9". The change is therefore safe across the full 3.9–3.13 CI matrix, regardless of whether a module usesfrom __future__ import annotations.ruff check .passes (including import-order ruleI).coordinates.pyruns correctly.Generated by Claude Code
Note
Low Risk
Import-only, behavior-preserving change aligned with the package’s Python ≥3.9 support; no logic or API surface changes.
Overview
Updates type-only imports to follow PEP 585: abstract collection types that were deprecated on
typingsince Python 3.9 now come fromcollections.abcinstead.Touched areas include sync/async chat completions (
Iterable), Navigator helpers (Iterable,Callable,Sequence), OAuth login (Callable), and CLI install/error helpers (Iterator,Mapping,Sequence). Annotations and call sites are unchanged; only import lines were split or rewired.Reviewed by Cursor Bugbot for commit 926aa28. Bugbot is set up for automated code reviews on this repo. Configure here.