[MAINTENANCE] Remove the follow_imports = 'silent' override block from the mypy configuration
Part of #12188.
What to do
Delete the [[tool.mypy.overrides]] block in pyproject.toml that sets
follow_imports = 'silent' for ten module patterns — the one annotated "TODO: remove these
overrides once we have typed the modules" — and regenerate the relaxation inventory in the
same change.
Once #12190 and #12191 have merged, every great_expectations.* and tests.* entry in that block
is inert: those modules are in files, so mypy checks them as build targets and
follow_imports no longer governs them. The one entry that can still do work is
contrib.experimental.great_expectations_experimental.*, because contrib/ is deliberately
outside files and is reached only by import. Done means: the block is gone, the run is
green, and contrib/ still reports nothing — by one explicit, documented decision rather
than a leftover.
Where
pyproject.toml— delete the whole silent-imports override block. Then, depending on what you measure (below), possibly add this one block in its place, comment included:
[[tool.mypy.overrides]]
# Community-contributed modules are maintained outside the checked package and are
# deliberately not part of the enforced type-check; their errors are not reported.
module = "contrib.experimental.great_expectations_experimental.*"
ignore_errors = truescripts/mypy_relaxation_inventory.json— regenerate with the guard's emit mode, never by hand. The ten silent entries drop out; theignore_errorsentry, if added, appears.- Nothing under
contrib/changes.
How to verify
! grep -q "follow_imports = 'silent'" pyproject.toml && invoke type-check --ciThen measure once more with the 'tests/expectations', exclude line also removed locally
(do not commit that removal — it belongs to #12131), because four modules under
tests/expectations/core/ import great_expectations_experimental and that is the only
edge that still reaches contrib/: regenerate the inventory, run invoke type-check --ci
again, and count lines beginning with contrib/.
Before: the fence exits 1 because the block is present; 945 source files checked, zero
errors (at 3798c021b with #12189–#12191 applied). Deleting the block alone: still zero. Deleting
it with tests/expectations also lifted: errors under contrib/ appear (25 at the last
measurement that reached them).
After: the fence exits 0; zero errors in both measurements; pytest tests/expectations/core
unchanged.
Requirements
- When the change merges, no
[[tool.mypy.overrides]]entry setsfollow_imports = 'silent'. - The type-check reports zero errors and no error whose path begins with
contrib/— both as-is and with thetests/expectationsexclusion lifted locally. - If the second measurement reports
contrib/errors, the singleignore_errorsoverride above is added in this change, verbatim, comment included. No error incontrib/is fixed, no file undercontrib/changes, and no silent-imports entry is retained. - If either measurement reports a new error outside
contrib/, comment on this issue with the listing before proceeding — that is a different problem than this issue describes. - The inventory must be regenerated by
python scripts/mypy_config_guard.py --emit-inventoryin the same change, and the guard must pass. pytest tests/expectations/core tests/rendermust pass with the same outcomes as before.
Out of scope: the tests/expectations exclusion itself (#12131); any exclude pattern
(#12190, #12191, #12128); any strictness flag; any edit under contrib/.
Order
- Blocked by #12191 — while any library exclusion stands, the block is doing real work: deleting
it before the lifts reveals 481 errors, after them at most 25, all in
contrib/.
Notes
- The order between this issue and #12131 is not fixed, which is why the second measurement
exists. If #12131 merges first, the plain deletion reveals the
contrib/errors directly and the override is clearly needed. If this merges first without the override, #12131 inherits those errors on a change that has nothing to do withcontrib/. Measuring both ways and adding the override when either showscontrib/errors keeps that cost off the other issue. - Do not "fix" the cost by removing the
great_expectations_experimentalimports from those four test modules — that changes what the tests exercise and is #12131's surface anyway.
Source: fivetran/great_expectations