-
Notifications
You must be signed in to change notification settings - Fork 609
Fix types, run typechecker in CI #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1ca8b79
to
bebf2b5
Compare
extra stuff found by mypy (mostly untyped defs):
|
6800f9d
to
a1d1130
Compare
5912594
to
6af971f
Compare
@@ -54,6 +55,21 @@ disallow_untyped_defs = true | |||
no_implicit_optional = false | |||
exclude = ["python/tests/"] | |||
|
|||
[tool.pyright] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pick one of pyright or mypy and drop the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would agree, would kinda lean towards sticking to mypy rather than making changes. pylsp-mypy exists though I assume it's slower
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a long-time mypy user, I like pyright more:
- can check untyped defs
- these things: https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md
- has way more options to warn/error on things we weren't checking for
Notably pyright actually passes the pydantic stuff :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...I've had check-untyped-defs on the entire time I've used mypy. but I have to agree that this is fairly compelling even if the javascript stuff is weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class PredictionRequest(schema.PredictionRequest.with_types(input_type=InputType)): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tldr this allows typingchecking PredictionRequest usage by pyright (still not mypy, though)
721d32f
to
a2971ec
Compare
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
a2971ec
to
2c8a65c
Compare
Love it! I'd like to request that if we go all in on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo failing tests (I think we'll have to use "old" ways of defining union types for a while to support <3.10) this seems great, particularly the bit where we typecheck in CI!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR probably shouldn't change async functionality
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
Signed-off-by: Yorick van Pelt <[email protected]>
982b2b8
to
9aca73b
Compare
Signed-off-by: Yorick van Pelt <[email protected]>
I fell into a typing hole while setting up pyright-lsp. Nevertheless, I think these are good changes, mostly preventing some annoying crashes (ast_openapi_scha + bytes defaults, cpus being uncountable).
Fixes #1360