Skip to content

Improve typecheck coverage in GitHub Actions #200

@lavr

Description

@lavr

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 typecheck

and the typecheck tox env runs:

mypy emails/

This means the job only checks the main emails package, with several important gaps:

  1. 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.
  2. 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.
  3. 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

  1. Extend the mypy target to include at least:

    • emails/
    • scripts/make_rfc822.py
  2. Replace global ignore_missing_imports = true with narrower per-module exceptions where needed.

  3. Add a separate typecheck environment for optional integrations, with the relevant dependencies installed, instead of using ignore_errors = true for:

    • emails.template.*
    • emails.django
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions