-
Notifications
You must be signed in to change notification settings - Fork 58
Improve typecheck coverage in GitHub Actions #200
Description
The current typecheck job in GitHub Actions is useful, but it does not fully cover the Python code we ship and support.
Today the workflow runs:
tox -e typecheckand the typecheck tox env runs:
mypy emails/This means the job only checks the main emails package, with several important gaps:
-
Optional integrations are effectively not type-checked.
emails.template.*is fully ignored in mypy config.emails.djangois fully ignored in mypy config.- Global
ignore_missing_imports = truealso weakens checks around external dependencies such ascssutils,lxml,premailer,requests, etc.
-
Shipped non-package Python code is not covered.
scripts/make_rfc822.pyis included in distribution but not checked by the CI typecheck job.setup.pyis also outside the current mypy target.
-
Tests and vendored code are excluded completely.
- Excluding vendored DKIM code is reasonable.
- Excluding tests may also be intentional, but it means typecheck currently validates only a subset of the repository's Python code.
As a result, the current job verifies the core package only, but does not give confidence for optional public integrations or shipped scripts.
Suggested improvements
-
Extend the mypy target to include at least:
emails/scripts/make_rfc822.py
-
Replace global
ignore_missing_imports = truewith narrower per-module exceptions where needed. -
Add a separate typecheck environment for optional integrations, with the relevant dependencies installed, instead of using
ignore_errors = truefor:emails.template.*emails.django
-
Keep vendored code excluded if desired, but make that an explicit documented decision.
Expected outcome
After this change, the typecheck job will better reflect the actual supported surface of the project and catch regressions in optional integrations and shipped scripts earlier.
If useful, I can also prepare a follow-up PR with concrete tox.ini, setup.cfg, and workflow changes.