Description Summary
Mypy, as currently configured, fails to run with poetry run mypy
The current mypy settings are hiding real typing issues in the repo
It would take time and effort to resolve all the mypy issues, but we'd certainly fix some real typing issues and possibly some algorithm issues
Details
When I refer to running mypy, I'm referring to poetry run mypy
The pinned version of mypy (v1.10.1) fails to run (with an internal error) on the current dev branch
Upgrading mypy (to the latest 1.x version, v1.20.2) resolves the issue
The mypy settings in pyproject.toml currently contain the line
follow_imports = 'skip' #may want to remove
Note the comment saying we may want to remove this!
Including this line introduces a few issues, such as hiding some real mypy errors.
Removing "follow_imports = 'skip'" and running mypy with the current mypy version (v1.10.1) yields many errors:
Found 234 errors in 62 files (checked 225 source files)
A lot of these are issues like "expected ndarray; got DataArray" or similar,
which expose mismatches between our declared APIs and their usage.
Removing this line and running mypy after the mypy upgrade (so using mypy v1.20.2) yields slightly fewer errors:
Found 220 errors in 60 files (checked 225 source files)
Same results when running the latest stable version of mypy, v2.3.0
Reactions are currently unavailable
You can’t perform that action at this time.
Summary
poetry run mypyDetails
When I refer to running mypy, I'm referring to
poetry run mypyThe pinned version of mypy (v1.10.1) fails to run (with an internal error) on the current dev branch
After upgrading, just one mypy error is reported with the current settings:
np.zerosreturns typenp.ndarray.Other errors discussed below are more serious.
The mypy settings in pyproject.toml currently contain the line
Note the comment saying we may want to remove this!
Including this line introduces a few issues, such as hiding some real mypy errors.
Removing "follow_imports = 'skip'" and running mypy with the current mypy version (v1.10.1) yields many errors:
which expose mismatches between our declared APIs and their usage.
Removing this line and running mypy after the mypy upgrade (so using mypy v1.20.2) yields slightly fewer errors: