Lintrunner changes mypy config somehow, type checks likely broken

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:

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.

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 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

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.