-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Currently, the mypy check in the Makefile lint target runs on the eth2spec packages as defined by:
Line 314 in 4f74348
| MYPY_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), -p eth2spec.$S) |
While working on #4627 I temporarily broke the mypy check and thefore realized it can be improved:
Line 323 in 4f74348
| @$(PYTHON_VENV) -m mypy --config-file $(MYPY_CONFIG) $(MYPY_SCOPE) |
Background: The work in #4627 moves Python project management to uv and, as such, uv sync --all-extras becomes the method to install all the project's dependencies. This also installs eth2spec in "editable" mode, whereas before, it was directly installed by the Makefile in the virtual env.
Improvement: We should typecheck our source by specifying the path to the eth2spec source tree itself (instead of as a package via -p). Indeed, with the above, some files are not checked, as they are outside the scope of the packages defined in MYPY_SCOPE.
Here are some options:
- Check everything under
tests/(2783 errors).
uv run mypy --explicit-package-bases tests/
- Check everything under
tests/core/pyspec/eth2spec/, includingtests/core/pyspec/eth2spec/test/(2390 errors).
uv run mypy --explicit-package-bases tests/core/pyspec/eth2spec/
- Check
tests/core/pyspec/eth2spec/, but excludetests/core/pyspec/eth2spec/test/(90 errors).
uv run mypy --explicit-package-bases tests/core/pyspec/eth2spec/ --exclude tests/core/pyspec/eth2spec/test/
- There's also this which includes
tests/infra,tests/generators/, ... but excludestests/core/pyspec/eth2spec/test/(505 errors).
uv run mypy --explicit-package-bases tests/ --exclude tests/core/pyspec/eth2spec/test/
As a tester, I like to treat test code is a first class citizen 🙂 and would go with 0. or 1., but 2. would be an improvement and a good start for the spec!