Skip to content

chore(typing): extend the Any ban to tools and examples - #799

Merged
janbjorge merged 1 commit into
mainfrom
chore/extend-any-ban-tools-examples
Sep 7, 2026
Merged

chore(typing): extend the Any ban to tools and examples#799
janbjorge merged 1 commit into
mainfrom
chore/extend-any-ban-tools-examples

Conversation

@janbjorge

Copy link
Copy Markdown
Owner

Follow-up to the strict-mypy stack (#789#797).

Changes

  • pyproject.toml — new ["tools.*", "examples.*"] mypy override adding disallow_any_explicit and disallow_any_unimported. Both directories already contained zero explicit Any, so this locks in the current state rather than fixing a backlog.
  • types-tqdm added to the dev extras. It was the only thing blocking disallow_any_unimported: without stubs, bar: tqdm silently degraded to Any.
  • tools/benchmark.py — with real stubs tqdm is generic, so the two annotations gain a parameter (tqdm[NoReturn]). The bar is only ever .update()d and read via .format_dict, never iterated, so no element type is observable.
  • .gitignore — ignore .claude/worktrees/. Only .claude/settings.local.json was listed, and git add -A has swept an embedded worktree into a commit before.
  • AGENTS.md — the typing section now states the ban covers pgqueuer/, tools/ and examples/, and that Any remains allowed under test/.

test/ is deliberately left alone: 88 Any across 18 files and 37 type: ignore across 16, in code whose job is to build malformed payloads and loose stubs. The ignore-without-code error code already applies there.

Verification

Check Result
uv run mypy . --no-incremental Success, 160 source files
uv run ruff check . / format --check passed / 159 formatted
uv run lint-imports 4 contracts kept, 0 broken
test/test_benchmark_grace_period.py 3 passed
git check-ignore .claude/worktrees/... matches the new rule

tools/ and examples/ already contained zero explicit Any, so the mypy
override locks in the current state before it drifts. disallow_any_unimported
needed types-tqdm, which makes tqdm generic, so the two bar annotations in
tools/benchmark.py gain a parameter; the bar is only updated and read for
format_dict, never iterated.

Also ignores .claude/worktrees/, which git add -A has swept into a commit
before.
@janbjorge
janbjorge merged commit 42738d0 into main Sep 7, 2026
22 checks passed
@janbjorge
janbjorge deleted the chore/extend-any-ban-tools-examples branch September 7, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant