fix(ci): bump minimum Python to 3.9 and fix type errors from #37#41
Closed
plutoless wants to merge 1 commit into
Closed
fix(ci): bump minimum Python to 3.9 and fix type errors from #37#41plutoless wants to merge 1 commit into
plutoless wants to merge 1 commit into
Conversation
PR #37 broke all three CI jobs: - test / compat-build: cn.py uses PEP 585 builtins (`list[str]`) which fail at Pydantic model-build time on Python 3.8. Raise the minimum supported version to 3.9 (pyproject + compat pyproject + CI matrix, poetry.lock refreshed) so the existing annotations are valid. - compile (mypy): fix the type errors introduced alongside the new regional/CN feature: * Remove the `@overload` stubs on Agent/Agora `__new__`/`__init__` (they could not be paired with their implementations by mypy). Runtime dispatch is unchanged; only static return-type precision is dropped. * __init__.py: import AgentClient/AsyncAgentClient from .pool_client (where they are defined) instead of .agentkit. * Agent.turn_detection / _resolve_asr_config: accept dict as well as the model, matching runtime behaviour. * regional_agent.py: type: ignore[override] for the intentional regional-vendor parameter narrowing. * test_regional_vendors.py: narrow Optional before indexing. Verified: mypy clean (303 files), 193 passed / 1 skipped, lock consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
The merge of #37 (
feat/add-cn-prefix) turnedmainCI red across all three jobs (run):testcn.pyuses PEP 585 builtins (list[str]), which Python 3.8 can't evaluate at Pydantic model-build time →TypeErroron importcompat-buildTypeErrorcompile(mypy)What
3.8 → 3.9(pyproject.toml, compatpyproject.toml, CI matrix,poetry.lockrefreshed). This makes the existinglist[...]annotations valid and fixestest+compat-buildwithout touching the generated annotations.compilejob:@overloadstubs onAgent/Agora__new__/__init__— mypy couldn't pair them with their implementations (they were nested underif TYPE_CHECKING:). Runtime dispatch is unchanged; only static return-type precision is dropped (a type checker now infersAgent/Agorarather thanCNAgent/CNAgora).__init__.py: importAgentClient/AsyncAgentClientfrom.pool_client(where they're defined) instead of.agentkit— a real bug.Agent.turn_detection/_resolve_asr_config: acceptdictas well as the model, matching runtime behaviour.regional_agent.py:# type: ignore[override]for the intentional regional-vendor parameter narrowing.test_regional_vendors.py: narrowOptionalbefore indexing.Verification
Locally with mypy 1.13.0 / pytest, targeting Python 3.9:
mypy .→ 0 errors (303 files)pytest→ 193 passed, 1 skippedpoetry lock --check→ consistent🤖 Generated with Claude Code