mypy
mypy copied to clipboard
Meta issue tracker
We have >1800 open issues, so it's easy to lose sight of ways we could make mypy better. Here's my summary of things I'd like to see.
Related to https://github.com/python/mypy/issues/6740, since I'd like as many of these as possible to be in a 1.0 release / some of these aren't backwards compatible :-)
UI
-
Import handling https://github.com/python/mypy/issues/8584
Why? We've made a lot of progress from the old days of #4542, but these are probably the most used configuration options and anything we can do to make them less confusing will go a long way. There's more detail in the linked issue, but tldr; namespace packages by default, improve
ignore-missing-imports
/install-types
/exclude
. -
Make
check_untyped_defs = True
the default https://github.com/python/mypy/issues/3948#issuecomment-890060233Why? This is by far the most common stumbling block for users. Gradual typing is great and we should continue to make it possible, but it's the roaring twenties and maybe we should make the default "mypy will actually check your code". (The other common gradual typing related change we could make is #4409 / #10149, but that's harder and maybe more contentious)
-
Make
--no-implicit-optional
the default https://github.com/python/mypy/issues/9091
Fixes
-
Member access https://github.com/python/mypy/issues/7724
Why? Will simplify mypy's code + click the issue to see list of bug reports this will help with.
-
Function type inference https://github.com/python/mypy/issues/5738 / https://github.com/python/mypy/issues/1317
Why? Use of generic higher order functions is currently pretty broken.
-
~Fix Callable instance variables https://github.com/python/mypy/issues/708~
We had most of a fix for this, but it was reverted in https://github.com/python/mypy/pull/11571
-
~Import cycle crash https://github.com/python/mypy/issues/8481~
Why? This is the unresolved crash that has been reported the most number of times. You can't e.g. really use PyTorch without running into it.
Behaviour changes
These have all been reported dozens of times.
-
Numbers https://github.com/python/mypy/issues/3186#issuecomment-762121456
Why? Understandably, people keep wanting to use
numbers
to type numbers and it doesn't work at all, contradictingisinstance
. I don't know that it's best solvable within mypy (I lean towards introducing lies in typeshed), but we should do something. -
Default value of generic parameters https://github.com/python/mypy/issues/3737#issuecomment-552840010
Why? It's totally reasonable to want to have generic parameters with defaults and there are paths forward to accomplish this (as also demonstrated by the behaviour of other type checkers).
-
Always narrow types https://github.com/python/mypy/issues/2008#issuecomment-296213676 (proposal 3)
Why? Users find it surprising because it seems obvious that mypy should know the variable is of the narrower type. There was a big discussion in typing-sig and all the type checkers agreed this behaviour was probably the best.
-
Detect unbound variables https://github.com/python/mypy/issues/2400 https://github.com/python/mypy/issues/686
-
Ternary joins https://github.com/python/mypy/issues/9264 / https://github.com/python/mypy/issues/5392 / https://github.com/python/mypy/issues/4134 / https://github.com/python/mypy/issues/12056
Why? Users find it inconsistent that
if-else
behaviour differs from ternary / not sure there's a good reason for mypy's current behaviour. Also brings us in line with other type checkers. -
Lost narrowing in inner functions https://github.com/python/mypy/issues/2608
Why? Users are often surprised by Python's behaviour here. In the general case mypy is correct, but given how much this comes up, in specific cases there are things we can do to reduce false positives: https://github.com/python/mypy/issues/2608#issuecomment-727074535. We also have bad false negatives here: https://github.com/python/mypy/issues/10993
Features
-
~PEP 612 https://github.com/python/mypy/issues/8645~
-
~PEP 613 https://github.com/python/mypy/issues/9404~
-
PEP 646 https://github.com/python/mypy/issues/12280
-
~match statement https://github.com/python/mypy/issues/10191~
-
~Recursive types https://github.com/python/mypy/issues/731~
(other maintainers, feel free to edit)
There are several meta issue trackers for different topics. Shall we add a meta
flags for them?
Yeah, a meta
or project
label is a good idea!
We've finished most of these, thanks in particular to Ivan! I've rolled over the remaining into a new meta issue https://github.com/python/mypy/issues/16472