Skip to content

chore: adopt mypy 2.1.0 across Python libs#7999

Closed
John Kennedy (jkennedyvz) wants to merge 4 commits into
mainfrom
chore/adopt-mypy-2.1.0
Closed

chore: adopt mypy 2.1.0 across Python libs#7999
John Kennedy (jkennedyvz) wants to merge 4 commits into
mainfrom
chore/adopt-mypy-2.1.0

Conversation

@jkennedyvz

Copy link
Copy Markdown
Contributor

Summary

Adopts mypy 1.20.2 → 2.1.0 across all Python libs and fixes the type errors surfaced by the stricter checker. mypy 2.x landed via Dependabot's grouped major bumps but broke make lint in several libs; this PR adopts it cleanly in one place.

Only mypy and its transitive deps (librt, ast-serialize) change in the lockfiles — no runtime dependencies (redis, websockets, starlette, etc.) are touched. Every source change is type-only (annotations, cast, # type: ignore adjustments) with no runtime behaviour change.

Changes by lib

Lib Fix
checkpoint-postgres kwargs: dict[str, Any] before Item(**kwargs)
checkpoint-sqlite params: list[Any] annotation
langgraph cast(...) for the retry deprecation path in state.py/func (fixes 3 downstream object errors); cast into chained_fut in _runner.py; targeted [arg-type] ignores in binop.py/func for generic/ParamSpec limits; removed now-unused ignores in delta.py/message.py
prebuilt cast("list[Any]", ...); narrowed an over-broad type: ignore
checkpoint, checkpoint-sqlite mypy override for the optional, untyped langgraph.checkpoint.conformance.* test module + return-type annotations on the conformance tests
cli, sdk-py mypy bump (sdk-py pin mypy==2.1.0); no source changes needed

Verification

make lint passes in all eight affected libs. Changes are type-only, so the test matrix is exercised by CI.

Relationship to open Dependabot PRs

Bump mypy 1.20.2 -> 2.1.0 in checkpoint, checkpoint-postgres,
checkpoint-sqlite, cli, langgraph, prebuilt and sdk-py, and fix the type
errors surfaced by the stricter checker. Only mypy and its transitive
deps (librt, ast-serialize) change in the lockfiles; no runtime
dependencies are bumped.

All changes are type-only (annotations, casts, type-ignore adjustments)
with no runtime behaviour change. make lint passes in every affected lib.

Supersedes dependabot PRs #7969, #7970 and #7974, and removes the mypy
portion of the grouped bumps in #7976 and #7972.
@jkennedyvz John Kennedy (jkennedyvz) force-pushed the chore/adopt-mypy-2.1.0 branch 2 times, most recently from 0ad74fb to 087e45d Compare June 3, 2026 07:44
@jkennedyvz John Kennedy (jkennedyvz) enabled auto-merge (squash) June 3, 2026 19:25
@jkennedyvz John Kennedy (jkennedyvz) marked this pull request as draft June 4, 2026 02:51
auto-merge was automatically disabled June 4, 2026 02:51

Pull request was converted to draft

@sydney-runkle

Copy link
Copy Markdown
Collaborator

closing since we're migrating to ty

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants