# Lintrunner changes mypy config somehow, type checks likely broken

**URL:** <https://dev-discuss.pytorch.org/t/lintrunner-changes-mypy-config-somehow-type-checks-likely-broken/2374>\
**Category:** testing\
**Created:** [August 10, 2024, 9:30am UTC](https://dev-discuss.pytorch.org/t/lintrunner-changes-mypy-config-somehow-type-checks-likely-broken/2374 "2024-08-10T09:30:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeinAlptraum](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/deinalptraum/32/2222_2.png) [@DeinAlptraum](https://dev-discuss.pytorch.org/u/DeinAlptraum)\
**Post date:** [August 10, 2024, 9:30am UTC](https://dev-discuss.pytorch.org/t/lintrunner-changes-mypy-config-somehow-type-checks-likely-broken/2374/1 "2024-08-10T09:30:34Z")

</div>

I’ve recently setup torch for contributing, and as I wanted to contribute to type annotations, looked into running mypy. To my surprise, I found 17 typing errors just by running `mypy` in the repo root, so I went to find out if/how this is checked in the CI, which is how I learned about lintrunner.  
After setting up lintrunner and running it once, the mypy errors have disappeared!

I don’t know what changed (no files have been edited) but the new check is definitely wrong. Take for example this line:

> <https://github.com/pytorch/pytorch/blob/2ad011ca73f68185783ec9afeb730615769a3fca/torch/_inductor/codegen/simd.py#L1785C13-L1785C70>

This was one of the errors initially reported on my first mypy run: `sympy.expr` doesn’t exist, it should be `sympy.Expr`. Fixing that, then putting a `reveal_type(new_tilings)` in the line below that and rerunning mypy gives `torch.utils._ordered_set.OrderedSet[tuple[Any]]`, so apparently the lintrunner somehow changed/broke mypy in a way that it does not properly infer the type here anymore.

As I’m quite new to the project, I have no idea what could be happening here and what magic `lintrunner init` does, but this is concerning as it means at least the type checking CI is currently broken.

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [August 11, 2024, 8:33pm UTC](https://dev-discuss.pytorch.org/t/lintrunner-changes-mypy-config-somehow-type-checks-likely-broken/2374/2 "2024-08-11T20:33:03Z")

</div>

Hey  
I’m not 100 sure qbout this one but my guess is that this particular file is skipped from linting for some reason. You can find the lintrunner config in [pytorch/.lintrunner.toml at e7b870c88bc3b854a95399a96a274d2f1f908172 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/blob/e7b870c88bc3b854a95399a96a274d2f1f908172/.lintrunner.toml#L130) where you can see special include/exclude (I don’t see this file in the exclude there). So I guess something in the mypy runner script referenced there is skipping it.

Cheers,  
Alban

---

<div class="post-metadata">

**Author:** ![DeinAlptraum](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/deinalptraum/32/2222_2.png) [@DeinAlptraum](https://dev-discuss.pytorch.org/u/DeinAlptraum)\
**Post date:** [August 11, 2024, 9:16pm UTC](https://dev-discuss.pytorch.org/t/lintrunner-changes-mypy-config-somehow-type-checks-likely-broken/2374/3 "2024-08-11T21:16:45Z")

</div>

Hi and thanks for your reply!

I don’t think the file is skipped. Putting another obvious type error in the same file and running `lintrunner` locally produces an error on the file.
