-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
how does pep-646 affect this project? #37
Comments
Good question! So I have looked into this already. At the moment, my plan is to continue focusing on dynamic shape checking (which of course requires no changes to this project). The reason is basically the poor state of the static typing ecosystem. It's tremendously difficult to write something that static type checkers will produce meaningful results for even in the non-variadic case, due to a number of bugs, limitations, and differences between static type checkers. E.g. the spec for And all of that's just the current state of things, without variadics entering the picture at all! I'd love to see something in this space. It might be possible to implement with enough effort, but it's not something I'm planning on working on. If you or anyone else reading this wants to have a go at this then reach out to me and I can give some more specific advice as a starting point. |
but if we narrow the discussion to just mypy, does this still hold? I mean, are there inconsistencies within mypy that make this issue particularly difficult to tackle? Also, i think it would be great to know how the devs at numpy ar going about this. After all i'll poke around numpy's issues i guess thanks for the quick response btw |
Yeah, there's all kind of oddities and problems. Most of the issues are actually still with Python itself -- not the static checkers. Let's do a quick tour.
Now, despite all of this... in principle, if we reign in our ambitions then I think it should be possible to implement static checking for:
...by using a Which would be a truly ridiculous amount of effort, be a huge maintenace burden, be a backwards-incompatible change -- and in doing so we'd cut TorchTyping down to a fraction of its current capabilities! All in all, this really just doesn't seem like it'd be worth anyone's time. To be honest, I gave up on the Python static typing ecosystem a long time ago; it's just too chock-full of crazy ideas. ( If you want nice types for scientific/ML computing then Dex is easily the best option currently around, and Julia comes an honourable second. Both have very poor ecosystems, of course. (One of them is still a research language!) So for those of us stuck using Python, runtime type checking will continue to remain pretty much the only choice for anything more than toy examples. |
wow, thanks a lot for the insight! many of the issues you raise are currently beyond my knowledge of the typing ecosystem, time for me to dig around a bit more. for now I have no further questions, so im closing the issue. thanks again for your excellent answers! |
hi!
how does the inclusion of variadic generics (pep-646) in python 3.11 affect this project?
will this allow mypy to statically check tensor shapes? maybe a plugin will be required?
just curious!
cheers
The text was updated successfully, but these errors were encountered: