Skip to content

Upgrade ty to 0.0.65 - #94

Draft
davegaeddert wants to merge 1 commit into
masterfrom
claude/great-cannon-7rm607
Draft

Upgrade ty to 0.0.65#94
davegaeddert wants to merge 1 commit into
masterfrom
claude/great-cannon-7rm607

Conversation

@davegaeddert

Copy link
Copy Markdown
Member

Summary

  • Bump ty from 0.0.63 to 0.0.65 (latest on PyPI) in pyproject.toml and uv.lock.
  • The newer release tightens overload resolution and bound-method assignment checks, surfacing two real gaps that needed fixing to keep ty check green:
    • plain-postgres/plain/postgres/meta.py: Field.name is typed str | None (only None before contribute_to_class runs), so the list.sort(key=...) calls no longer type-checked against list.sort's overloads. Sorting always happens after all fields are contributed, so falling back to "" is a safe, inert-at-runtime fix.
    • plain-jobs/tests/internal/test_otel.py: ty now also flags 4 more instances of the same bound-method-overwrite pattern that neighboring lines in the same file were already # ty: ignore[invalid-assignment]'d for (test-only monkeypatching of a partially-constructed Worker). Added matching ignore comments rather than restructuring the test.
  • Checked for now-unnecessary # ty: ignore comments across the whole workspace with unused-ignore-comment, blanket-ignore-comment, and ignore-comment-unknown-rule enabled as warnings (ty check --warn ... --error-on-warning) — none found, so nothing to remove this round.
  • Ran /simplify and /code-review on the diff; both came back clean.

Changelog highlights (0.0.64 → 0.0.65)

  • Stricter/improved core type checking: constrained TypeVar solutions, tagged-union narrowing through all type kinds, frozen-dataclass handling, generic PEP 695 type aliases.
  • Pydantic: frozen-model private-attribute mutation, synthesized __replace__.
  • Performance: avoids quadratic inference for large literal unions, caches protocol receiver binding.
  • CLI: --exclude-scripts/--include-scripts, uv workspace root discovery.

Test plan

  • uv run ty check — all checks pass (including with unused-ignore-comment / blanket-ignore-comment / ignore-comment-unknown-rule promoted to warnings)
  • uv run plain-code fix on the two changed Python files — no further changes
  • ./scripts/test plain-postgres / ./scripts/test plain-jobs — could not run in this sandbox (no Postgres/Docker available); please run in CI

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_016A6qTRAeQhzz3DjL7DfCEb


Generated by Claude Code

Picks up two releases (0.0.64, 0.0.65) worth of stricter checking:
narrower TypeVar solutions, tagged-union narrowing, and tighter
overload resolution surfaced two real gaps.

- plain-postgres/meta.py: Field.sort() key functions returned
  `str | None` (name is only None before contribute_to_class runs),
  which the new overload resolution correctly rejects for list.sort's
  key parameter. Fall back to "" since sorting always happens after
  fields are contributed.
- plain-jobs test_otel.py: ty now also flags 4 more of the same
  bound-method-overwrite pattern that neighboring lines in this file
  were already ty:ignore'd for; added matching ignores rather than
  restructuring test-only monkeypatching.

No stale ty:ignore comments were found when checking with
unused-ignore-comment/blanket-ignore-comment/ignore-comment-unknown-rule
enabled, so nothing to remove this round.
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.

2 participants