Skip to content

chore: switch from mypy to ty for Python type checking#5761

Merged
max-sixty merged 5 commits intomainfrom
fix/bump-mypy-1.19.1
Apr 1, 2026
Merged

chore: switch from mypy to ty for Python type checking#5761
max-sixty merged 5 commits intomainfrom
fix/bump-mypy-1.19.1

Conversation

@prql-bot
Copy link
Copy Markdown
Collaborator

@prql-bot prql-bot commented Apr 1, 2026

Summary

  • Switch Python type checking from mypy to ty (Astral's type checker)
  • Update dependency, nox session, and README accordingly
  • Regenerate uv.lock

Requested in #5761 (comment)

Bumps [mypy](https://github.com/python/mypy) from 1.18.1 to 1.19.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.18.1...v1.19.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 1.19.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@max-sixty
Copy link
Copy Markdown
Member

@prql-bot can you switch from mypy to ty?

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prql-bot prql-bot changed the title chore: bump mypy from 1.18.1 to 1.19.1 in /prqlc/bindings/prqlc-python chore: switch from mypy to ty for Python type checking Apr 1, 2026
@prql-bot
Copy link
Copy Markdown
Collaborator Author

prql-bot commented Apr 1, 2026

Done — switched from mypy to ty across pyproject.toml, noxfile.py, README.md, and regenerated uv.lock. Waiting on CI.

prql-bot and others added 3 commits April 1, 2026 01:38
- Exclude noxfile.py from ty checking (build infrastructure)
- Add ty: ignore for .prqlc native extension import
- Add explicit import of prqlc.debug submodule in tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The explicit `import prqlc.debug` breaks pytest because it's a native
PyO3 submodule, not a Python subpackage. Suppress the warning in
ty config instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rule severity is configured as `rule-name = "level"`, not as a list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
#
# This is the default module init provided automatically by Maturin.
from .prqlc import *
from .prqlc import * # ty: ignore[unresolved-import]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this prevent all type checking?!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No — ty: ignore[unresolved-import] only suppresses the unresolved-import diagnostic on that single line. All other type checking remains active. The .prqlc module is a native PyO3 extension that only exists after Maturin builds it, so ty can't resolve the import statically — same reason the old mypy config had ignore_missing_imports = true for similar cases.

The pyproject.toml config also sets possibly-missing-submodule = "ignore" for prqlc.debug (another native submodule), but everything else is checked normally.

That said, if you'd prefer a different approach — like a stub file or removing the ignore — happy to adjust.

@max-sixty max-sixty merged commit f905676 into main Apr 1, 2026
46 checks passed
@max-sixty max-sixty deleted the fix/bump-mypy-1.19.1 branch April 1, 2026 05:06
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