pytorch / pytorch/executorch

examples/ is outside the mypy lint scope, which let a missing-attribute bug reach main

Open
#22,302 1 comment 0 reactions 2 assignees View on GitHub

@kirklandsign is already working on this.

Since Sep 10, 2026.

module: ci module: dev infra
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

What

.lintrunner.toml comments examples/**/*.py out of the mypy scope, leaving only examples/arm and
examples/openvino. The mypy lint job is the one gate that runs on every pull request, and it
would have caught a bug that shipped on main and took a separate PR to fix.

Concretely, #22298 fixes a read of a config field that no longer exists. Running the exact pinned
mypy 1.14.1 from requirements-lintrunner.txt with the repo's .mypy.ini against that expression:

error: "BackendConfig" has no attribute "mps"  [attr-defined]

Clean after the fix. So the broken PR would have gone red in seconds. The macOS job that did catch it
lives in trunk.yml, which does not start for a change to that directory, so the bug reached main
and failed there first.

What it would cost

Not free. examples/models/llama/export_llama_lib.py alone reports 20 mypy errors today, 14 of them
not import-not-found, and the lint job runs over all files in scope, so they would all have to be
fixed in the same change. One of those errors looks like a real bug rather than a typing nit.

Filing rather than doing it, since it is a much larger change than the fix that surfaced it, and the
per-directory cost should probably be assessed by whoever owns examples/.

Found while reviewing #22298.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.