Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Jan 30, 2026

While exploring #9410, the user found that our type hints are not being adequately checked across different Python versions - jorenham#1 (comment)

This PR stops specifying the mypy Python version in pyproject.toml, so that it defaults to the current version being run, and adds a matrix to our Lint job to check multiple versions.

Python 3.10 required tomli - https://github.com/python-pillow/Pillow/actions/runs/21516054322/job/61994586354
and Python >= 3.12 required some changes in Buffer handling - https://github.com/python-pillow/Pillow/actions/runs/21516054322/job/61994586341

@hugovk
Copy link
Member

hugovk commented Jan 30, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants