Repository navigation
fix(mypy): set num_workers = "auto" in the mypy config - #81
Merged
Merged
Conversation
#79 moved this to a CI-only `--num-workers auto` flag because validate-pyproject rejects the value: SchemaStore's mypy schema still types num_workers as an integer. Put it back in [tool.mypy], so local `mypy` runs are parallel too, and disable only the mypy schema in the validate-pyproject hook until the schema catches up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="project_name/pyproject.toml.jinja" line_range="189" />
<code_context>
[tool.mypy]
files = ["src", "tests"]
mypy_path = "stubs"
+num_workers = "auto"
# set the platform
python_version = "3.{{ python_min }}"
</code_context>
<issue_to_address>
**Pre-commit mypy stays serial**
When the pre-commit mypy hook runs, the pre-commit mypy hook passes `--config-file ''`, so it does not load `[tool.mypy]` and never sees `num_workers = "auto"`; that local mypy entry point continues using the default worker count.
Allow that hook to read the project config, or pass `--num-workers auto` explicitly if it must remain config-free.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: project_name/pyproject.toml.jinja:189
| [tool.mypy] | ||
| files = ["src", "tests"] | ||
| mypy_path = "stubs" | ||
| num_workers = "auto" |
There was a problem hiding this comment.
🟡 Medium · Pre-commit mypy stays serial
When the pre-commit mypy hook runs, the pre-commit mypy hook passes --config-file '', so it does not load [tool.mypy] and never sees num_workers = "auto"; that local mypy entry point continues using the default worker count.
Allow that hook to read the project config, or pass --num-workers auto explicitly if it must remain config-free.
Prompt for AI agents
In `project_name/pyproject.toml.jinja` at line 189:
**Pre-commit mypy stays serial**
When the pre-commit mypy hook runs, the pre-commit mypy hook passes `--config-file ''`, so it does not load `[tool.mypy]` and never sees `num_workers = "auto"`; that local mypy entry point continues using the default worker count.
Allow that hook to read the project config, or pass `--num-workers auto` explicitly if it must remain config-free.
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.
Summary
Follow-up to #79, which backed out of
num_workers = "auto"in[tool.mypy]and passed--num-workers autoonly in CI, becausevalidate-pyprojectrejects the value: SchemaStore's mypy schema still typesnum_workersas an integer.This puts the setting back in the config, so local
mypyruns are parallel too, and relaxes the pre-commit hook instead.Changes
pyproject.toml.jinja: addnum_workers = "auto"to[tool.mypy]..pre-commit-config.yaml.jinja: pass--disable-plugins mypy --to thevalidate-pyprojecthook. Only the mypy schema is skipped; the other tool schemas (ruff, uv, pytest, ...) are still validated. A TODO marks it for removal once SchemaStore accepts"auto".ci.yml.jinja: drop--num-workers autofrom the mypy step, since the config now covers it.Testing
just testpasses: all seven generated projects render, and theValidate pyproject.tomlhook passes in each withnum_workers = "auto"present.🤖 Generated with Claude Code