Skip to content

fix(mypy): set num_workers = "auto" in the mypy config - #81

Merged
tsvikas merged 1 commit into
mainfrom
mypy-num-workers-auto-config
Oct 5, 2026
Merged

tsvikas merged 1 commit into
mainfrom
mypy-num-workers-auto-config

Conversation

@tsvikas

@tsvikas tsvikas commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #79, which backed out of num_workers = "auto" in [tool.mypy] and passed --num-workers auto only in CI, because validate-pyproject rejects the value: SchemaStore's mypy schema still types num_workers as an integer.

This puts the setting back in the config, so local mypy runs are parallel too, and relaxes the pre-commit hook instead.

Changes

  • pyproject.toml.jinja: add num_workers = "auto" to [tool.mypy].
  • .pre-commit-config.yaml.jinja: pass --disable-plugins mypy -- to the validate-pyproject hook. 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 auto from the mypy step, since the config now covers it.

Testing

just test passes: all seven generated projects render, and the Validate pyproject.toml hook passes in each with num_workers = "auto" present.

🤖 Generated with Claude Code

#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>

@sourcery-ai sourcery-ai 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.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

[tool.mypy]
files = ["src", "tests"]
mypy_path = "stubs"
num_workers = "auto"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.

@tsvikas
tsvikas merged commit 8a6625e into main Oct 5, 2026
6 of 11 checks passed
@tsvikas
tsvikas deleted the mypy-num-workers-auto-config branch October 5, 2026 21:05
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