Conversation
Member
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
I don't have enough time for an actual review of the typing changes but I think you could add a manual pre-commit conf and add pyright's conf in the pyproject.toml fir future use (like for pylint and pyupgrade)
Member
Author
|
@Pierre-Sassoulas I forgot this was an option. Added! |
These often appear in Protocols and ABCs and are never executed so not expected to be covered.
Mostly to fix the TODO, doesn't have much semantic meaning. Also fixes a related typo in import inside `TYPE_CHECKING` block.
It's not different from the `tmp_path_factory` already requested via fixture.
pyright (somewhat annoyingly IMO) infers unannotated function types, unlike mypy which treats them as `Any`. In these 2 cases it causes some follow on type errors, so add explicit `Any`s to prevent pyright from inferring some big union.
For some reason pyright infers the type of `essential_plugins` and `default_plugins` as `tuple[Literal[...], ...]` even if they are explicitly annotated as `tuple[str, ...]`. This then causes an error in the `builtin_plugins.add` calls. Replace with one-shot initialization appeases pyright and is nicer regardless.
This is the expected case for casts -- the correct type is ensured dynamically, just too complicated for a type checker to understand.
Pyright complains:
Type annotation for "self" parameter of "__init__" method cannot
contain class-scoped type variables (reportInvalidTypeVarUse)
and I figure it's not needed since it's already the type of `self`.
Pyright doesn't handle this.
There is not much reason to use `TypeGuard` on the implementation function of an `@overload`ed function, since only the types of the overloads are used. This fixes a pyright "Overloaded implementation is not consistent with signature of overload" error.
For manual testing, as we are not yet passing.
Member
Author
|
I am going to add a coveragerc ignore for |
73f1a44 to
7a48181
Compare
nicoddemus
approved these changes
Jun 2, 2025
Member
nicoddemus
left a comment
There was a problem hiding this comment.
Nice work!
Curious, why did you decide to test on pyright? Are you using it yourself at work/other projects?
Member
Author
|
My editor started showing squigglies from pyright and I couldn't help fix a few :) |
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.
I ran pyright on
src/and fixed some of the errors which seemed good to fix (see commits for details). There are ~100 remaining errors, I may look at them in the future.FTR the pyright config: