Gate ty as a third type checker and release 1.7.2#19
Merged
Conversation
- fluids: declare _composition with the Composition alias (drops a cast), build the Series result in one expression instead of casting through Any - sympy: hoist the knowns|avoid union out of the closure (ty does not narrow captured variables, and this also avoids re-unioning per call), annotate _get_val with the precise Quantity[Any, ...] return - units: cast the Series/Expr branch of _validate_magnitude like every sibling branch, hoist one dict[str, Any] cast in _pydantic_build_quantity - tests: hoist the second_point declaration above both branches Where pyright strict genuinely requires a cast() to launder Unknown but ty resolves the type on its own, keep the cast with a ty: ignore[redundant-cast]. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All suppressed lines pass pyright strict and pyrefly unmodified, and every one of them is exercised at runtime by the test suite. The ignores fall into three groups where ty disagrees with both other checkers: - constrained-TypeVar solving: ty substitutes a union of constraints for MT (a constrained TypeVar must solve to exactly one constraint), rejecting valid Fluid/Water/HumidAir constructor calls and Quantity operator uses - isinstance narrowing: ty materializes TypeVar defaults into the narrowed type (Quantity -> Quantity[UnknownDimensionality, Numpy1DArray]) and keeps sound-but-noisy intersections like float & ndarray that break member access - override strictness: ty flags the intentionally-narrowed comparison and pickling overrides that already carry pyright/pyrefly ignores where those checkers flag them too Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- run `ty check --error-on-warning` in the typecheck job after pyright and
pyrefly, so ty's own warnings (e.g. a typo'd rule in an ignore comment)
fail the gate too
- elevate unused-ignore-comment to error, matching pyright's
reportUnnecessaryTypeIgnoreComment and pyrefly's unused-ignore
- pin the Q("24 kg") / Q(1, Q(2, "m")) static rejections under ty in
test_static_typing.py, twinned with the existing pyright/pyrefly tests
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mirror the pyright/pyrefly doc-block tests with a ty variant (--project resolves the repo config from tmp_path, --error-on-warning matches CI). The one block ty cannot solve (mixed vector/scalar Water inputs, the same constrained-TypeVar limitation suppressed in the test suite) carries the same rule-specific ignore, next to the existing pyright precedent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Documents the three-type-checker gate (pyright as source of truth, per-checker rule-specific suppressions, unused-suppression policing), the executable-docs rule, the library invariants (no string quantities, no implicit physical identities, temperature-difference semantics, one CoolProp property per node), and the build/release tooling. CLAUDE.md redirects here via @AGENTS.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
[tool.ty.terminal] error-on-warning = true makes every `ty check` invocation (CI, doc-block tests, local runs) fail on warnings without remembering a flag. Verified: a warning-level diagnostic exits 1 with no CLI arguments. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…check The rename to "typecheck (pyright + pyrefly + ty)" orphaned the required status check on main (required checks match on the exact job name), which blocked merging. Restore the protected name and document the constraint; the job itself still gates on all three checkers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
# ty: ignore[...]comments where ty disagrees with pyright (the source of truth) and pyrefly — all suppressed lines pass both other checkers unmodified and are exercised at runtime by the test suitety checkin the CI typecheck job; warnings fail too via[tool.ty.terminal] error-on-warning = true, andunused-ignore-commentis elevated to error so stale suppressions cannot lingertest_docs.py) and the static-rejection guarantees (test_static_typing.py) to ty, twinned with the existing pyright/pyrefly variantsAGENTS.mddocumenting the three-checker protocol, executable-docs rule and library invariants, withCLAUDE.mdredirecting to itVerification
🤖 Generated with Claude Code