feat(checks): map MY family to ty and pyrefly config#818
Merged
Conversation
MY100 now passes for any of `tool.mypy`, `tool.pyrefly`, or `tool.ty`, matching PC140. MY101 maps mypy's `strict` to pyrefly's `preset`. The remaining MY checks cover mypy-only concepts with no ty/pyrefly equivalent, so they skip (return None) when mypy is not configured rather than failing. Closes #813 Assisted-by: ClaudeCode:claude-opus-4.8
A stray VPP001 section crept in from running cog with a fuller venv; the canonical list comes from the minimal `readme` session. Assisted-by: ClaudeCode:claude-opus-4.8
Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
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.
🤖 AI text below 🤖
Closes #813.
Previously MY100 only passed for
tool.mypy, so projects usingty(orpyrefly) failed it even though PC140 already accepts all three type checkers.Changes
tool.mypy,tool.pyrefly, ortool.ty.strict(bool) to pyrefly'spreset(any value). ty has no strict switch, so this check is skipped when only ty is configured.show_error_codes,warn_unreachable, and theenable_error_codeentries) with no ty/pyrefly equivalent. They now skip (returnNone) when mypy is not configured, instead of failing. Since theyrequireMY100 — which now passes for ty/pyrefly — skipping is what keeps them from failing on absent mypy keys.Design note
Only MY100 and MY101 had genuine cross-tool mappings. ty tightens individual
[tool.ty.rules]and pyrefly toggles[tool.pyrefly.errors], neither with a clean 1:1 to mypy's error codes — so rather than invent fuzzy mappings, the mypy-specific checks skip for non-mypy users. Happy to adjust if you'd prefer a different treatment.Tests & docs
{rr}cross-references in the style guide's pyrefly/ty tabs.📚 Documentation preview 📚: https://scientific-python-cookie--818.org.readthedocs.build/