Skip to content

Allow Mypy Strict as a Build Directory's Only Type Checker - #2005

Merged
ptr727 merged 9 commits into
developfrom
feature/python-mypy-only-build
Sep 28, 2026
Merged

ptr727 merged 9 commits into
developfrom
feature/python-mypy-only-build

Conversation

@ptr727

@ptr727 ptr727 commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

This applies the maintainer's decision on #1941: a build-profile Python directory may use mypy as its only CI type checker. The validator's type-check step already accepts that configuration. A follow-up answer holds whichever checker runs in CI to strict.

  • spec/project-types.json: python.pyright.config now says first-party code is type-checked in CI by pyright strict, by mypy, or by both, and that each CI checker runs strict (pyright strict mode, mypy's strict flags). python.mypy.allowed now allows mypy as a build directory's only CI checker.
  • python-codestyle skill (SKILL.md, references/profiles.md, references/code-style.md) and README.md say the same, including that mypy runs strict. The skill no longer says a pyright-only repo is the default when there is no need for mypy. It also no longer calls a mypy-only repo "inherently consistent", which is true only when the editor and CI run the same engine.
  • The generated skill distributions are regenerated.

Mypy is named by "its strict flags" rather than strict = true, because that key is global and a test tree can only be relaxed flag by flag.

Local strict review: three passes plus a confirming pass, with every introduced finding fixed. A pre-existing gap it found, suppression guidance that names only pyright mechanisms, is filed as #2004.

Refs #1941

🤖 Generated with Claude Code

ptr727 and others added 4 commits September 28, 2026 10:08
The validator's type-check step accepts a declared directory whose
config names mypy or pyright, while python.pyright.config scored a
mypy-only build directory as a finding. Per the maintainer's decision
on #1941, relax python.pyright.config and python.mypy.allowed to match
the gate: a build directory is type-checked in CI by pyright strict,
by mypy, or by both, and pyright runs strict wherever it is a CI
checker.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first commit dropped the build profile's strictness bar for a
mypy-only directory, so an empty [tool.mypy] passed the audit while
pyright in standard mode failed it. Per the maintainer's answer, each
CI checker runs strict: pyright strict mode or mypy strict = true.

The python-codestyle skill still made mypy conditional on a need and
kept a repo with none pyright-only. Reword it to allow mypy strict as
a build repo's only CI checker, matching #1941's decision.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
README.md, the python-codestyle skill's baseline paragraph, and
code-style.md still offered mypy in CI with no strictness, so a reader
following them configured what python.pyright.config now scores as
drift. Name mypy's strict flags there rather than strict = true, since
that key is global and a test tree is relaxed flag by flag.

The skill also called a mypy-only repo inherently consistent, which
holds only for pyright-only, where the editor and CI run one engine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
"pyright strict, mypy strict, or both" sat at the end of a four-item
list, so "both" had no clear pair. Name it as the CI type-checker
choice.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 18:41
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 761b9cee-b3e2-411a-bbeb-9a694617080e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.42%. Comparing base (2583371) to head (7990b21).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2005   +/-   ##
========================================
  Coverage    55.42%   55.42%           
========================================
  Files           16       16           
  Lines         7249     7249           
========================================
  Hits          4018     4018           
  Misses        3231     3231           
Flag Coverage Δ
python-3.13 55.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

A few updated documentation passages are now internally inconsistent about mypy-only CI configurations and strictness terminology, which can mislead readers.

Review effort: Lite
Findings: 3 Low severity

Open (3)
What changed in this PR

This pull request updates the fleet spec and documentation to explicitly allow a build-profile Python directory to run mypy as its only CI type checker, and clarifies that whichever type checker runs in CI must run in strict mode.

Changes:

  • Relax python.mypy.allowed to permit mypy as the only CI checker for build-profile Python directories, and update python.pyright.config to describe pyright strict / mypy strict / both as valid CI configurations.
  • Update Python codestyle skill docs and repo README to reflect the expanded CI type-checker options and strictness expectations.
  • Regenerate distributed skill copies and update the plugin source digest.
File Description
spec/​project-types.json Updates spec assertions for build-profile type checking to allow pyright strict, mypy strict, or both.
README.md Updates the Python project checklist line to include mypy strict and dual-checker options.
.github/​skills/​python-codestyle/​SKILL.md Regenerated distribution copy of python-codestyle with updated strictness/type-checker guidance.
.github/​skills/​python-codestyle/​references/​profiles.md Regenerated distribution copy reflecting updated CI type-checker options.
.github/​skills/​python-codestyle/​references/​code-style.md Regenerated distribution copy clarifying mypy strictness phrasing.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​SKILL.md Regenerated plugin distribution copy of python-codestyle.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​references/​profiles.md Regenerated plugin distribution copy reflecting updated CI type-checker options.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​references/​code-style.md Regenerated plugin distribution copy clarifying mypy strictness phrasing.
.claude-plugin/​fleet-skills/​.source-digests/​python-codestyle Updates digest for the regenerated python-codestyle plugin content.
.agents/​skills/​python-codestyle/​SKILL.md Source skill text updated to document pyright strict / mypy strict / both as valid CI configurations.
.agents/​skills/​python-codestyle/​references/​profiles.md Source profile reference updated to reflect strict CI checker options.
.agents/​skills/​python-codestyle/​references/​code-style.md Source code-style reference updated to clarify mypy strictness phrasing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .agents/skills/python-codestyle/SKILL.md Outdated
Comment thread .agents/skills/python-codestyle/references/profiles.md Outdated
Comment thread README.md Outdated
Review of #2005 found "mypy strict" read as a single config knob on
the surfaces that name the CI checker, while the spec and code-style
say mypy's strict flags. Use that wording on every such surface.

The skill also said the editor and CI never disagree because Pylance
embeds pyright, which holds only where CI runs pyright.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 28, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Some updated policy text still encodes pyright-specific assumptions (and omits mypy-only CI implications), which can leave the spec and guidance internally inconsistent for the newly supported configuration.

Review effort: Lite
Findings: 3 Low severity

Open (3)
Resolved since last review (3)
Previously missed (1)

In code that hasn't changed since last review

Low severity Add mypy config file forms to placement rule

spec/​project-types.json:43

The python.config.placement assertion still calls out standalone pyrightconfig.json as drift, but it does not mention mypy's equivalent standalone config forms (mypy.ini/.mypy.ini or setup.cfg [mypy]). The CI validator explicitly recognizes those files as type-checker configuration sources for declared directories (.github/workflows/validate-task.yml:291-309), so the spec should name them here as well to keep the placement rule accurate when mypy is the only CI checker.

Comment thread .agents/skills/python-codestyle/SKILL.md
Comment thread .agents/skills/python-codestyle/references/profiles.md Outdated
Comment thread README.md Outdated
ptr727 and others added 3 commits September 28, 2026 11:55
Review of #2005 read "mypy with its strict flags in CI and pyright
editor-only" as mypy being CI-only, while the skill runs mypy in CI and
the editor. Say both in README.md and profiles.md.

python.config.placement named pyrightconfig.json as drift but none of
mypy's standalone forms, which a mypy-only build directory now reaches.
Name mypy.ini, .mypy.ini, and a setup.cfg [mypy] section beside it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
AUDIT.md's python line still required pyright and named only
pyrightconfig.json as standalone drift, so an auditor following it
scored a mypy-only build directory as missing pyright and missed
mypy's standalone forms. Match python.pyright.config and
python.config.placement.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The previous wording demanded a strict checker of every Python
directory, while python.pyright.config, which carries the strictness
rule, is N/A for the lint-only profile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 28, 2026 18:57
@ptr727

ptr727 commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

Previously missed: Add mypy config file forms to placement rule (spec/project-types.json:43). The python.config.placement assertion still calls out standalone pyrightconfig.json as drift, but it does not mention mypy's equivalent standalone config forms (mypy.ini/.mypy.ini or setup.cfg [mypy]).

Fixed in be33d4b: python.config.placement now names mypy.ini, .mypy.ini, and a setup.cfg [mypy] section as drift beside pyrightconfig.json, and the Home Assistant exception is unchanged. a332967 adds the same list to AUDIT.md's python line and scopes its strictness demand to the build profile.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Two updated documentation passages remain ambiguous/incorrect in the “or both” case by implying exactly one CI checker (“whichever runs in CI”) and should be reworded for clarity and correctness.

Review effort: Lite
Findings: 2 Low severity

Open (2)
Resolved since last review (3)

Comment thread .agents/skills/python-codestyle/references/profiles.md Outdated
Comment thread README.md Outdated
README.md and profiles.md offer pyright, mypy, or both, then said
"whichever runs in CI", which assumes exactly one. State what holds
for each checker CI runs instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 28, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The changes consistently align the spec and documentation with the intended contract (mypy-only strict CI allowed for build profile) without introducing behavioral code changes or inconsistencies.

Review effort: Lite
Findings: None

Resolved since last review (2)

@ptr727
ptr727 merged commit af0b7ac into develop Sep 28, 2026
11 checks passed
@ptr727
ptr727 deleted the feature/python-mypy-only-build branch September 28, 2026 19:07
ptr727 added a commit that referenced this pull request Sep 28, 2026
…y Type Checker (#2006)

## Summary

Promotes develop to main, carrying
[#2005](#2005).

That PR applies the maintainer's decision on #1941: a build-profile
Python directory may use mypy as its only CI type checker, and whichever
checker CI runs is held to strict (pyright strict mode, or mypy's strict
flags).

- **Spec:** `python.pyright.config` and `python.mypy.allowed` now match
what the validator's type-check step accepts. `python.config.placement`
names mypy's standalone config forms as drift beside
`pyrightconfig.json`.
- **Surfaces:** the `python-codestyle` skill, `README.md`, and
`AUDIT.md` state the same rule. Strictness is scoped to the build
profile, and the "never disagree" claim applies only where CI runs
pyright.

A pre-existing gap found along the way, suppression guidance that names
only pyright mechanisms, is filed as #2004.

Closes #1941

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants