Fix type checking failures
Author: sirosenCreated Jul 9, 2025Updated Aug 4, 2026
Labelsmaintenance
I recently tried to fix our usage of mypy to get it out of .pre-commit-config.yaml.
The result revealed that type checking really isn't passing -- it's not clear what the hook is doing, but it's not complete type checking.
I moved mypy into a tox environment, created pinned dependencies to mirror the current hook config, and ran it in a relatively naive configuration. mypy failed with 111 errors.
For anyone who wants to reproduce, here's what I tried as a first pass at this in tox.ini:
[testenv:typing]
description = type check the code
deps =
mypy
-c constraints/typing.txt
commands =
mypy --python-version 3.8 piptools/ {posargs}
mypy --python-version 3.12 piptools/ {posargs}
[testenv:pip-compile-typing]
description = compile constraints for type checking
commands =
python -m piptools compile --quiet --strip-extras ./pyproject.toml -o ./constraints/pip-tools.txt
python -m piptools compile --quiet --strip-extras --allow-unsafe ./constraints/typing.in ./constraints/pip-tools.txt -o ./constraints/typing.txtand constraints/typing.in was:
mypy >= 1.16.1
pip == 20.3.4I'm not sure how we'll want to approach this. I assume the pre-commit hook isn't doing nothing but it's almost definitely not type checking properly.
Source: jazzband/pip-tools