Skip to content

Python: Split type checkers by target (pyright source, 5 checkers on tests/samples)#6443

Draft
eavanvalkenburg wants to merge 1 commit into
microsoft:mainfrom
eavanvalkenburg:typing_exp
Draft

Python: Split type checkers by target (pyright source, 5 checkers on tests/samples)#6443
eavanvalkenburg wants to merge 1 commit into
microsoft:mainfrom
eavanvalkenburg:typing_exp

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation and Context

Following the "too many type checkers"
approach, this reworks our typing setup so that each target is checked by the
right tool(s):

  • The source ran two strict checkers (mypy + pyright), doubling the
    annotation burden and producing checker-specific friction on internal code.
  • Tests and samples were under-checked, so type problems in the way customers
    actually call the public API only surfaced downstream.

The goal: make source development easier (one source checker) while giving
customers more confidence that running any of the five common type checkers
against their own code will surface fewer surprises.

Description

  • Source: Pyright (strict) is now the sole source-code type checker.
    MyPy is removed from source; its [tool.mypy] block becomes a relaxed
    profile used only for tests/samples.
  • Tests: checked by all five checkers — pyright (relaxed), mypy, pyrefly,
    ty, and zuban.
  • Samples: checked by pyright, pyrefly, and ty (mypy/zuban can't resolve
    script-style sample layouts).
  • The relaxed/basic profiles intentionally disable noisy rules (private-access,
    not-required TypedDict access, untyped test bodies) so test/sample authors
    aren't forced into ugly over-annotation. Narrow, rule-specific ignores
    (# pyright: ignore[rule], # type: ignore[code]) are used only where a
    checker is pedantic.
  • Added pyrightconfig.tests.json; bumped sample pyright configs to basic.
  • Added pyrefly.toml, pyrefly.samples.toml, ty.samples.toml.
  • Unified test/sample typing onto the same parallel fan-out used by source
    pyright (run_command_items in scripts/task_runner.py) for consistent
    execution.
  • Made version-conditional imports symmetric: the # type: ignore is now kept
    or dropped on both branches, so results match across interpreter versions
    (local vs CI) instead of only matching the current venv.
  • Updated SKILL.md, DEV_SETUP.md, and CODING_STANDARD.md for the five
    gating checkers and pyright over source + tests + samples.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings June 10, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

…tests/samples)

Rework the typing setup along the lines of the 'too many type checkers'
approach:

- Pyright (strict) is now the sole source-code type checker; mypy is
  removed from source and its [tool.mypy] block becomes a relaxed profile
  used only for tests/samples.
- Tests are checked by all five checkers (pyright relaxed, mypy, pyrefly,
  ty, zuban); samples by pyright, pyrefly, and ty. All run in a relaxed/
  basic profile so authors aren't forced into over-annotation.
- Add pyrightconfig.tests.json and bump sample pyright configs to basic.
- Unify test/sample typing onto the same parallel fan-out used by source
  pyright via run_command_items in task_runner.py.
- Make version-conditional imports symmetric: keep or drop the
  '# type: ignore' on both branches so results match across interpreter
  versions (local vs CI).
- Update SKILL.md, DEV_SETUP.md, and CODING_STANDARD.md for the five
  gating checkers and pyright on source+tests+samples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added documentation Improvements or additions to documentation python lab Agent Framework Lab labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lab Agent Framework Lab python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants