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:
and the typecheck tox env runs:
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.django is fully ignored in mypy config.
- Global
ignore_missing_imports = true also weakens checks around external dependencies such as cssutils, lxml, premailer, requests, etc.
-
Shipped non-package Python code is not covered.
scripts/make_rfc822.py is included in distribution but not checked by the CI typecheck job.
setup.py is 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 = true with narrower per-module exceptions where needed.
-
Add a separate typecheck environment for optional integrations, with the relevant dependencies installed, instead of using ignore_errors = true for:
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.
The current
typecheckjob in GitHub Actions is useful, but it does not fully cover the Python code we ship and support.Today the workflow runs:
and the
typechecktox env runs:This means the job only checks the main
emailspackage, 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.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.
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.pyReplace 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.djangoKeep vendored code excluded if desired, but make that an explicit documented decision.
Expected outcome
After this change, the
typecheckjob 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.