-
Notifications
You must be signed in to change notification settings - Fork 51
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
mypy type checking seems to break in strict mode -- a mypy bug? #52
Comments
I can't replicate your issue I'm afraid. Running: import torch
from jaxtyping import Float
def simple_test_a(x: Float[torch.Tensor, "dim1"]) -> torch.Tensor:
reveal_type(x)
return x
def simple_test_b(x: Float[torch.Tensor, "dim1"]) -> float:
reveal_type(x)
return x.item()
def simple_test_c(x: Float[torch.Tensor, "dim1"]) -> None:
reveal_type(x)
x.asdfasdfasdf() prints:
This is with versions:
As for VSCode, this issue is due to a now-resolved bug in pyright: microsoft/pyright#4287 . Try updating your pyright version. |
Interesting, it seems to be related with
As soon as I add a [mypy]
strict = True the output becomes:
Note that even the revealed types change. Using exactly the same package versions. Looks like a mypy bug? |
Following up on patrick-kidger/torchtyping#41 I'm trying the same things here. However I'm not really having a big success so far with mypy. Am I doing anything wrong?
VSCode (pyright) seems to do a little better, but apparently doesn't like the import:
The text was updated successfully, but these errors were encountered: