Skip to content

Port type checking from mypy to ty#294

Merged
pamelafox merged 1 commit into
mainfrom
port-mypy-to-ty
May 16, 2026
Merged

Port type checking from mypy to ty#294
pamelafox merged 1 commit into
mainfrom
port-mypy-to-ty

Conversation

@pamelafox
Copy link
Copy Markdown
Contributor

Purpose

Port Python type checking from mypy to ty.

This updates the development dependency, CI type-check command, repo configuration, and related documentation/checklists. It also includes small type-checker compatibility updates for OpenAI Agents stream event narrowing and an eval-only ty suppression.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[x] No

Type of change

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[x] Other... Please describe: Development tooling change

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m ty check to check for type errors
  • I either used the pre-commit hooks or ran ruff manually on my code.

Validation run:

  • ruff check .
  • /usr/local/bin/python -m ty check . --python-version 3.12 --extra-search-path /home/vscode/.local/lib/python3.12/site-packages

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Replaces the mypy type checker with ty across the project — updating dev dependencies, CI workflow, configuration, ignore files, IDE settings, contributor docs, and a couple of small in-code adjustments needed for ty compatibility.

Changes:

  • Swap mypyty in requirements-dev.txt, CI workflow, pyproject.toml config, and docs/templates.
  • Replace event.type == "raw_response_event" checks with isinstance(event, RawResponsesStreamEvent) in both RAG modules so ty can narrow event.data.
  • Switch a # type: ignore to a # ty: ignore suppression in evals/generate_ground_truth.py.
Show a summary per file
File Description
requirements-dev.txt Replace mypy dependency with ty.
pyproject.toml Drop [tool.mypy] config; add [tool.ty.environment] and [tool.ty.analysis] with allowed unresolved imports.
.github/workflows/app-tests.yaml Remove mypy cache step; run ty check with GitHub output format.
.github/PULL_REQUEST_TEMPLATE.md Update checklist to reference ty check.
.github/copilot-instructions.md Update type-checking commands/notes to use ty.
.vscode/settings.json Stop hiding .mypy_cache from explorer.
.gitignore Remove mypy cache ignore entries.
src/backend/fastapi_app/rag_simple.py Import RawResponsesStreamEvent and use isinstance for stream-event narrowing.
src/backend/fastapi_app/rag_advanced.py Same isinstance-based stream-event narrowing change.
evals/generate_ground_truth.py Replace # type: ignore[list-item] with # ty: ignore[invalid-argument-type].

Copilot's findings

  • Files reviewed: 9/10 changed files
  • Comments generated: 0

@pamelafox pamelafox merged commit 76c6b76 into main May 16, 2026
14 checks passed
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