Skip to content

Investigate ty type checker alongside mypy #681

Description

@tony

Summary

ty is Astral's Rust-based Python type checker (beta). It's 10-100x faster than mypy, checks unannotated function bodies by default, and supports advanced features like intersection types and reachability analysis.

libtmux is well-positioned for ty adoption:

  • No mypy plugins in use (ty's biggest gap — no plugin system)
  • Only 9 type: ignore comments across the codebase
  • Already uses Astral's ruff and uv tooling
  • Strict mypy configuration with full type annotations

Goals

  1. Add ty as a dev dependency alongside mypy (not replacing it)
  2. Add ty configuration in pyproject.toml and justfile targets
  3. Add ty to CI as a non-blocking step
  4. Compare diagnostics: what ty catches vs mypy, false positives, speed
  5. Determine if ty can eventually displace mypy

Approach

  • Gradual adoption: run both checkers in parallel
  • Start with known-noisy rules suppressed, re-enable incrementally
  • CI runs ty with continue-on-error: true so it doesn't block builds
  • Document findings in the PR for future reference

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions