Run mypy against multiple Python versions by radarhere · Pull Request #9414 · python-pillow/Pillow

@radarhere

@radarhere

@radarhere

@hugovk

Do we really need to run mypy on every version? Should we run on the oldest supported, or latest? Is there authoritative guidance on best practices here?

If we do decide to type check on multiple versions, let's move mypy to its own job (can name it like typing for when we switch to ty or pyrefly or something) and only apply the matrix there. The other linting can remain on an single version.

And can we continue to use a new Python interpreter but call mypy with --python-version instead of setting up older interpreters?

https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-python-version

@radarhere

@radarhere

let's move mypy to its own job (can name it like typing for when we switch to ty or pyrefly or something)

And can we continue to use a new Python interpreter but call mypy with --python-version instead of setting up older interpreters?

Sure, done.

Do we really need to run mypy on every version? Should we run on the oldest supported, or latest? Is there authoritative guidance on best practices here?

python/mypy#12286 is an issue requesting the ability to check multiple versions at once. From the fact that it is still open, you might infer that this isn't an official priority.

@jorenham did you have any thoughts?

@jorenham

@jorenham did you have any thoughts?

In the projects I maintain I run all supported typecheckers against the full range of supported Python versions. The main reason is to ensure that all if sys.version_info < ... branches are actually checked, and to avoid incorrect typing/typing_extensions/ imports.

@hugovk hugovk changed the title Run Lint against multiple Python versions Run mypy against multiple Python versions

Feb 9, 2026