5 ms·
Mypy 1.5 Released
- arjvik 3y agoI've read a lot of good things about Google's `pytype`, which supposedly does a better job inferring types of unannotated code than `mypy`. Has anyone used `pytype` seriously, and does it compare? Is there a reason to prefer `mypy` at all, other than the fact that it's (mostly) first-party?
- ehutch79 3y agopytypes readme specifically says it doesn't support 3.11. so it's a non-starter for me.
- zem 3y agopytype dev here - we're actively working on 3.11 support at the moment, targeting somewhere in Q4.
- ehutch79 3y agoOut of curiousity, serious questions. Is this support for specific features, or does it just not work in 3.11? What's the issue? High level anyways, I'm sure there's stuff that seems basic, but is incredibly complex under the proverbial covers.
- zem 3y agopytype works by symbolic execution of compiled python bytecode, and the bytecode changed a fair bit between 3.10 and 3.11. we essentially have to implement some of the new features of the cpython interpreter first to simply execute 3.11 code, after which we need to handle new typing features. (we have to do this for every new version, but usually the bytecode doesn't change as much, it's typically new python features like pattern matching, and new typing features like variadic generics, that take time to implement in pytype)
- ehutch79 3y agoThanks for the response. That sounds like a pretty monumental task
- djvdq 3y agoLack of Windows support is also big no-no.
- jscheel 3y agoSo, I tried out pytype the other day, and it was a not a good experience. It doesn't support PEP 420 (implicit namespace packages), which means you have to litter __init__.py files everywhere, or it will create filename collisions. See https://github.com/google/pytype/issues/198 https://github.com/google/pytype/issues/198 for more information. I've since started testing out pyre.
- eternityforest 3y agoTIL PEP 420 exists! I'm not entirely sure if I like it... Now there's two ways of doing the same thing and one is not really explicit....
- aitchnyu 3y agoTangential, but is there a way to annotate an expression as non-nullable? In TS we have `expression!`, but in Python we have to `assert var is not None` after `var = fn_that_returns_str_or_none`.