Skip to content

fix(ci): bump minimum Python to 3.9 and fix type errors from #37#41

Closed
plutoless wants to merge 1 commit into
mainfrom
fix/ci-bump-python-3.9
Closed

fix(ci): bump minimum Python to 3.9 and fix type errors from #37#41
plutoless wants to merge 1 commit into
mainfrom
fix/ci-bump-python-3.9

Conversation

@plutoless

Copy link
Copy Markdown
Collaborator

Why

The merge of #37 (feat/add-cn-prefix) turned main CI red across all three jobs (run):

Job Cause
test cn.py uses PEP 585 builtins (list[str]), which Python 3.8 can't evaluate at Pydantic model-build time → TypeError on import
compat-build Same import-time TypeError
compile (mypy) 32 type errors introduced alongside the new regional/CN feature

What

  • Bump minimum Python 3.8 → 3.9 (pyproject.toml, compat pyproject.toml, CI matrix, poetry.lock refreshed). This makes the existing list[...] annotations valid and fixes test + compat-build without touching the generated annotations.
  • Fix the mypy errors for the compile job:
    • Remove the @overload stubs on Agent/Agora __new__/__init__ — mypy couldn't pair them with their implementations (they were nested under if TYPE_CHECKING:). Runtime dispatch is unchanged; only static return-type precision is dropped (a type checker now infers Agent/Agora rather than CNAgent/CNAgora).
    • __init__.py: import AgentClient/AsyncAgentClient from .pool_client (where they're defined) instead of .agentkit — a real bug.
    • 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.

Verification

Locally with mypy 1.13.0 / pytest, targeting Python 3.9:

  • mypy .0 errors (303 files)
  • pytest193 passed, 1 skipped
  • poetry lock --check → consistent

🤖 Generated with Claude Code

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>
@plutoless plutoless closed this Jun 17, 2026
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.

1 participant