Skip to content

chore: require type annotations with disallow_untyped_defs - #131

Merged
proxi merged 1 commit into
mainfrom
proxi/mypy-disallow-untyped-defs
Dec 1, 2026
Merged

proxi merged 1 commit into
mainfrom
proxi/mypy-disallow-untyped-defs

Conversation

@proxi

@proxi proxi commented Dec 1, 2026

Copy link
Copy Markdown
Member

Last step of the typing series (#127, #128, #129, #130): every function in the repo is annotated now, so turn the flag on to keep it that way.

  • Adds disallow_untyped_defs = true under [tool.mypy] in pyproject.toml.
  • Both the CI type-check job and the pre-commit mypy hook read it from there, so neither needs a change.

Untyped functions over the series: 142 → 0.

Tested:

  • uv run --locked mypy bitmapist test examples scripts (the CI command) passes.
  • mypy 2.4.1 with the hook's arguments and dependencies passes.
  • Negative check: a temporary file with def probe(x): return x fails with Function is missing a type annotation [no-untyped-def] in both setups, without passing the flag on the command line.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGjgWiXoieBLCLiXckPSe9

Every function in the repository is annotated now, so turn the mypy
flag on to keep it that way. Both the CI type-check job and the
pre-commit hook read it from pyproject.toml.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGjgWiXoieBLCLiXckPSe9
@proxi proxi added the 🚢 Ship PR requires passing checks before merge, but no independent human review. label Dec 1, 2026
@proxi
proxi marked this pull request as ready for review December 1, 2026 13:37

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR flips on disallow_untyped_defs = true under a new [tool.mypy] table in pyproject.toml, capping the typing series by locking in full annotation coverage across the codebase. The config lands cleanly alongside the existing mypy overrides, and both the CI type-check job and the pre-commit mypy hook pick it up from pyproject.toml with no flag changes needed. All Python targets (bitmapist, test, examples, scripts) are covered by the check, so nothing escapes it. No inline issues were flagged; the change is minimal, correctly placed, and well verified.

I also left one optional follow-up note in the details below.

Optional follow-up note (1)
  • P3 pyproject.toml:261: disallow_untyped_defs alone only rejects functions with no annotations at all; a function with annotated params but a missing return annotation still passes. Adding disallow_incomplete_defs = true alongside it closes that gap and matches the stated intent that every function needs full annotations.

Share Feedback • Review Logs • Trace

@proxi
proxi merged commit 1330ab1 into main Dec 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚢 Ship PR requires passing checks before merge, but no independent human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants