Repository navigation
chore: require type annotations with disallow_untyped_defs - #131
Merged
Merged
Conversation
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
marked this pull request as ready for review
December 1, 2026 13:37
doistbot
reviewed
Dec 1, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
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)
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 = truealongside it closes that gap and matches the stated intent that every function needs full annotations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
disallow_untyped_defs = trueunder[tool.mypy]inpyproject.toml.type-checkjob 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.def probe(x): return xfails withFunction 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