Skip to content

feat: Add ty type checker support#4015

Draft
alec-bike wants to merge 7 commits intovega:mainfrom
alec-bike:add-ty-config
Draft

feat: Add ty type checker support#4015
alec-bike wants to merge 7 commits intovega:mainfrom
alec-bike:add-ty-config

Conversation

@alec-bike
Copy link
Copy Markdown
Contributor

@alec-bike alec-bike commented Apr 21, 2026

This concept PR adds initial ty type checker support to altair. To keep ty separate from existing mypy (and pyright), a new ty.toml configuration file is used for now.

The PR addresses the following issues:

  • peg ruff and mypy to latest version, fix associated errors
  • remove mypy-specific annotations from type: ignore (see note below)
  • fix minor type issues
  • remove some Union and pyright: ignore that are no longer needed
  • add some ty: ignore to flag issues that do not yet have a fix

Limitations:

  • only check altair/vegalite
  • exclude altair/vegalite/v6/schema
  • no ty support in CI

mypy-specific annotations

Annotations such as type: ignore[arg-type] are no longer treated as type: ignore by ty. Converting these to generic type: ignore does work with ty (and should with most other type checkers).

There are discussions around cross-compatibility between mypy and ty (see astral-sh/ty#3127), which would obviate this issue in some cases.

Alternatively, ty-specific annotations could be added (type: ignore[arg-type, ty:invalid-argument-type]), but this is quite verbose (and requires adding more annotations if future type checkers are adopted).

This PR proposes reverting to the generic type: ignore by removing some existing mypy-specific annotations. @mattijn and @dangotbanned, we could use this concept PR as a sounding board to discuss whether this is the best approach.

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