Skip to content

Enable mypy parallel workers in pre-commit#2185

Merged
adamtheturtle merged 5 commits into
mainfrom
chore/mypy-docs-parallel-workers
May 19, 2026
Merged

Enable mypy parallel workers in pre-commit#2185
adamtheturtle merged 5 commits into
mainfrom
chore/mypy-docs-parallel-workers

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

  • enable parallel doc example execution for mypy-docs via doccmd --example-workers 4
  • keep mypy invocation compatible with current mypy CLI while fixing doccmd hook wiring
  • add uv as an explicit mypy-docs hook dependency for consistent hook environment resolution

Test plan

  • pre-commit run --hook-stage pre-push mypy --all-files
  • pre-commit run --hook-stage pre-push mypy-docs --all-files

Made with Cursor


Note

Low Risk
Low risk: only updates pre-commit hook commands/dependencies, with the main downside being potential flakiness or resource contention from parallel mypy runs on some machines.

Overview
Pre-push mypy hooks now run in parallel. The mypy pre-commit hook is updated to invoke mypy --num-workers=4.

Docs type-checking is aligned with the same parallelism and environment. The mypy-docs hook’s doccmd command is rewired to pass mypy --num-workers=4 and now explicitly includes uv via additional_dependencies for consistent hook resolution.

Reviewed by Cursor Bugbot for commit b43fa4d. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align mypy and mypy-docs entries with inline --num-workers=4 usage and remove the example-workers variant.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .pre-commit-config.yaml
name: mypy
stages: [pre-push]
entry: uv run --extra=dev -m mypy
entry: uv run --extra=dev -m mypy --num-workers=4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using mypy 2.0 flag with pinned 1.20.2 version

High Severity

The --num-workers=4 flag is a mypy 2.0 feature (parallel type checking), but the project pins mypy[faster-cache]==1.20.2 in pyproject.toml and uv.lock. Since uv run --extra=dev -m mypy resolves to the locked 1.20.2 version, both the mypy and mypy-docs hooks will fail with an unrecognized argument error. The mypy 1.20 release blog and release planning issue (#20726) confirm parallel type checking was planned exclusively for 2.0.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f455ade. Configure here.

adamtheturtle and others added 2 commits May 7, 2026 15:34
Skip the pre-commit-ci lite-action during PR runs so lint checks don't fail on stale cherry-pick conflicts, while preserving autofix behavior on push workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b43fa4d. Configure here.

Comment thread .pre-commit-config.yaml
stages: [pre-push]
entry: uv run --extra=dev doccmd --no-write-to-file --language=python --command="mypy"
entry: uv run --extra=dev doccmd --no-write-to-file --language=python --command="mypy
--num-workers=4"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Doc parallelization uses wrong flag

Medium Severity

The mypy-docs hook adds mypy --num-workers=4 inside doccmd --command, but the PR goal is parallel doc-example runs via doccmd --example-workers 4. num-workers only parallelizes work inside one mypy process; doccmd still runs each extracted snippet largely serially, so the intended docs speedup is missing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b43fa4d. Configure here.

@adamtheturtle adamtheturtle merged commit 7554274 into main May 19, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the chore/mypy-docs-parallel-workers branch May 19, 2026 11:15
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