TYP: Check untyped defs (except vendored) by simonjayhawkins · Pull Request #37556 · pandas-dev/pandas (original) (raw)

@jbrockmendel has recently addressed many of the modules that were not previously checked. There are now many less modules outstanding.

There has been a concern in the past that if we add ignores, the issues may not be addressed and sit in the codebase. (from previous experience with other linting tools)

There are however pros to including the ignores. The issues are visible to people working on the relevant code and when reviewing the code. Also as mypy will be checking the relevant modules, PRs changing these modules will have additional static checking on ci and the chance of regression/errors is likely reduced.

IMO the pros always outweighed the cons, but now that there are less ignores involved (admittedly the number is still not trivial), I think it is appropriate to reconsider this approach.

One caveat, NumPy types currently resolve to Any and we have not yet discussed how we will 'switch' to using NumPy types #36092. (reverting to using check_untyped_defs=False on some modules could make the switch more managable)

Another possible upside, is in the review of typing PRs to fix these issues. Reviewers of typing PRs cannot see explicitly see why changes are being made and a typical reviewer is normally suspicious of any changes to the codebase. This can lead to long review cycles of typing PRs. I'm not sure if having the resolved mypy errors in the diff will help, but if the hypothesis is correct could be an argument for following a similar approach for resolving the numerous errors that will be reported once NumPy types no longer resolve to Any