Skip to content

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

Description

@shoumikhin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions