Fix constructor signatures and test annotations for ty - #3965
Merged
Merged
Conversation
Contributor
|
should we make |
kevinjqliu
approved these changes
Sep 14, 2026
kevinjqliu
enabled auto-merge
September 14, 2026 20:48
Collaborator
Author
|
@kevinjqliu we very much should not...yet. Mypy and ty have conflicting views on which Once we get |
auto-merge was automatically disabled
September 14, 2026 20:59
Head branch was pushed to by a user without write access
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.
Rationale for this change'
tyexposes out 3,547 type errors. This gets us down to 655 type errors. These errors all stem from the fact that mypy is ignoring errors relating to optional dependencies.These come from two different situations:
__init__methods on Pydantic subclasses. This ends up being an issue on expressions mostly. I found a GitHub issue on Pydantic that talks about the same issue. The duplicative__init__methods are annoying, but I don't see any way around it.client=Nonesince it won't be coming from an untyped dictionary. This actually feels more correct, since client isn't a property. This is only occurring in tests and it's a semantic difference. This feels like splitting hairs with the type checker, but I'm happy to let it do its thing.Are these changes tested?
Run
uv run ty check.Are there any user-facing changes?