Skip to content

Tracking: gradual introduction of ty type checking #2709

@filiplajszczak

Description

@filiplajszczak

What is the problem or limitation you are having?

There is no type checking in the project. Type errors are caught only at runtime or during review. Previous discussion (#665) concluded that mypy was too slow and annotations weren't an inherent good. ty changes the equation — it checks all of src/briefcase/ in ~0.16s.

See Type checking with ty (discussion) for background.

Describe the solution you'd like

Gradually introduce ty type checking, module by module, without disrupting existing workflows.

Current state:

  • 597 diagnostics on src/briefcase/ with ty 0.0.18
  • Many are unresolved-attribute from dynamic attribute access on BaseConfig/AppConfig
  • ~60% of files already have from __future__ import annotations
  • Newer code (channels, integrations, debuggers) already uses Protocols and annotations

Roadmap:

Describe alternatives you've considered

  • mypy: too slow for pre-commit/CI integration, heavier configuration burden
  • pyright: faster than mypy but still heavier than ty; not part of the existing Astral toolchain
  • Do nothing: viable, but misses real catches (e.g. functions with implicit None returns typed as -> bool)

Additional context

Principles agreed on in the discussion:

  • ty adapts to the codebase, not the other way around
  • Non-blocking until a module is explicitly opted in
  • Pin ty version, upgrade deliberately
  • Dynamic attributes are intentional. Platform modules may stay excluded or warn-only long-term

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features, or improvements to existing features.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions