Adopt mypy
and stronger enforcement of pylint
#1719
Labels
enhancement
New feature or request
information
For development/intsructional purposes
standards / conventions
Suggestions on ways forward
Addressing a Problem?
Why would we want to do this?
mypy
.Potential Solution
We start using
mypy
in our linters and set some fairly high thresholds forpylint
. We currently usepylint
with some allowances (our code rating is hovering around 9.6/10, so we're nearly there).mypy
is a fairly involved check, so perhaps we would run the comprehensive checks from it as part of thelint
job on GitHub, and run a more relaxed threshold for it as part of thepre-commit
configurations (to catch obvious errors).pylint
can be configured for stronger checks across both (runs very fast).Although we've already ticked most of the boxes, this change might still need to occur progressively (as the documentation suggests). I can imagine this requiring effort from all maintainers to help determine what can easily be typed and what we can comfortably ignore.
Additional context
I think we have been gradually making our way towards this for several years. The quality of our code has been improved thanks to the existing
pylint
checks (soft) as well as the battery of linters we use. The last steps needed to ensuremypy
-compliant code will help address some finer issues that are often raised in other linters as well (flake8
,ruff
,vulture
)This goal is something that was also brought up by a few research developers I spoke with at PyCon Lithuania. This would be a medium-effort solution that would provide some security, code optimization, some potential speedups, and would benefit downstream projects hoping to adopt
mypy
as well for their code bases.The comprehensive guide to
mypy
: https://dev.to/tusharsadhwani/the-comprehensive-guide-to-mypy-561mContribution
Code of Conduct
The text was updated successfully, but these errors were encountered: