mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Mypy 0.980 Release Planning

Open jhance opened this issue 3 years ago • 25 comments

I am planning to make a 0.980 release around late August.

Please post here any issues you'd like to see fixed in the release, or PRs you'd like to have merged. There is no release branch yet - I will update the issue once it exists.

jhance avatar Aug 11 '22 16:08 jhance

Would be good to have a fix for https://github.com/python/mypy/issues/13227#issuecomment-1193318303 (note: I see Jukka happened to fix the message in https://github.com/python/mypy/pull/13382 )

hauntsaninja avatar Aug 11 '22 18:08 hauntsaninja

As mentioned in that issue, it would also be good for mypyc docs to be built, they're getting really stale: https://github.com/mypyc/mypyc/issues/920

hauntsaninja avatar Aug 11 '22 18:08 hauntsaninja

I would prefer my generic PRs included: https://github.com/python/mypy/pull/13389, https://github.com/python/mypy/pull/13396 (I mean I could just merge them, but ideally it would be great if someone looked at them)

ilevkivskyi avatar Aug 14 '22 21:08 ilevkivskyi

Thanks @JelleZijlstra for stepping up and reviewing the PRs!

ilevkivskyi avatar Aug 15 '22 09:08 ilevkivskyi

Regression on master with subtyping of Type: https://github.com/python/mypy/pull/13303#issuecomment-1220342535

hauntsaninja avatar Aug 19 '22 07:08 hauntsaninja

Hm, it is not really about Type[...] by itself, it rather uncovered some existing inconsistencies. There actually two things: inconsistent type inference, and inconsistent overlapping for <nothing>.

On the first one, there are three ways a type inference can fail:

  • Impossible to satisfy pair, like List[T] <: int
  • Always satisfied pair, like List[T] <: object
  • Pair that can't be satisfied because of type variable upper bound, like Lits[T] <: List[int], where T <: str.

The problem is that which way it goes may depend on whether T appears in a nested position and/or inside a union. For general call checking it is not very important, we just get different error messages. But the problem is that we use constraints inference for various other things, e.g. overload consistency checks. To illustrate, here is a minimal repro:

T = TypeVar("T", bound=str)
@overload
def foo(x: Type[T] | int) -> int: ...  # Bogus error: Overloaded function signatures 1 and 2 overlap with incompatible return types
@overload
def foo(x: Callable[[int], bool]) -> str: ...

What is weird here, is that if I remove the | int part, it passes, while it is obvious that int can't be the reason for overlap. And indeed the reason is that without the union we get Cannot infer type variable code path, and with the union we get T = <nothing> code path.

Another inconsistency is that is_overlapping_types() returns True if is_proper_subtype() returns True for some pair. This is peoblematic w.r.t. <nothing>. Namely, [] == [42] is a totally safe thing, so we should say list[<nothing>] and list[int] are overlapping. But for overload checks, we could say the are not overlapping, because we already ignore empty lists for e.g. list[int] vs list[str]. Another repro to illustrate:

T = TypeVar("T", bound=str)

@overload
def foo(x: List[T]) -> str: ...  # Same bogus error here.
@overload
def foo(x: Sequence[int]) -> int: ...

While it passes if I put a plain List[str] there.

Fixing either of issues will fix the bug. I am not sure what is the best way. On one hand, union inference is known to cause many problems (e.g. @jhance discovered another false positive in a similar situation just couple days ago), but on other hand it is a very dangerous thing to touch. So I will probably go with fixing the second, unless there are other ideas.

ilevkivskyi avatar Aug 19 '22 11:08 ilevkivskyi

OK, since I didn't hear any other ideas here is https://github.com/python/mypy/pull/13461 for the above issue.

ilevkivskyi avatar Aug 20 '22 18:08 ilevkivskyi

Btw https://github.com/python/mypy/pull/13471 would be great to include (it is low risk because it is behind --enable-incomplete-features anyway, and fixes currently most upvoted issue).

ilevkivskyi avatar Aug 21 '22 15:08 ilevkivskyi

Also I think https://github.com/python/mypy/pull/13381 would be good to include (fixes an annoying crash).

ilevkivskyi avatar Aug 23 '22 01:08 ilevkivskyi

New crash on master #13536. Bisects to #13494

cdce8p avatar Aug 27 '22 21:08 cdce8p

Fix https://github.com/python/mypy/pull/13538 (but also I think will be after this release branch base)

ilevkivskyi avatar Aug 27 '22 23:08 ilevkivskyi

Oh have we cut the release branch base? I don't see it in https://github.com/python/mypy/branches... If you post the commit here I can mention if I think there are things on master that are important that didn't make it in

hauntsaninja avatar Aug 28 '22 07:08 hauntsaninja

I talked to @jhance privately few days ago, and he told me he is thinking about making https://github.com/python/mypy/commit/4d4326ac5ddfcb796184acb7646f7c31266f9126 the base of release branch.

ilevkivskyi avatar Aug 28 '22 09:08 ilevkivskyi

Hm, actually I am not sure now, he said "last typeshed sync", but I am not sure which one he meant.

ilevkivskyi avatar Aug 28 '22 09:08 ilevkivskyi

We should make sure to include https://github.com/python/mypy/pull/13500 in the next release. Currently users of Python 3.10.7 and numpy are broken.

If you create the release branch, I can make sure to backport any necessary changes.

hauntsaninja avatar Sep 08 '22 22:09 hauntsaninja

We should make sure to include #13500 in the next release. Currently users of Python 3.10.7 and numpy are broken.

+1, we've had two duplicates reported today

AlexWaygood avatar Sep 08 '22 22:09 AlexWaygood

We should make sure to include #13500 in the next release. Currently users of Python 3.10.7 and numpy are broken.

Yes please! I spent almost two hours before finding the closed issues for this today (my project's mypy version didn't change (still 0.942, just the python version bump). The longer we wait for #13500, the more people will have adopted 3.10.7 and come reporting this here again

Edit: Thank you for pinning, I think that's actually a great way to spread awareness

zevisert avatar Sep 08 '22 23:09 zevisert

#13425 is causing a lot of noise for my group and it ended up landing juuuuuust the wrong side of the line; we'd be grateful to see it in this release.

tdsmith avatar Sep 09 '22 20:09 tdsmith

Backport PR for tdsmith's change here: https://github.com/python/mypy/pull/13644

hauntsaninja avatar Sep 10 '22 01:09 hauntsaninja

Typeshed's test suite is currently quite badly broken on the master and release-0.980 branches:

  • #13654

AlexWaygood avatar Sep 12 '22 22:09 AlexWaygood

Backport PR for the custom typeshed dir regression here: https://github.com/python/mypy/pull/13658

hauntsaninja avatar Sep 13 '22 02:09 hauntsaninja

@hauntsaninja Thanks for fixing this!

ilevkivskyi avatar Sep 13 '22 09:09 ilevkivskyi

Backport PR to fix tests with 3.10.7: #13665

cdce8p avatar Sep 14 '22 12:09 cdce8p

Maybe also backport #13687, tweaks the error message of a new check added in 0.980.

intgr avatar Sep 19 '22 15:09 intgr

Is there any updated ETA on this? Original comment mentions late August while it is mid-September now and at least the #13500 issue is biting more and more users as they update to Python 3.10.7.

J08nY avatar Sep 19 '22 17:09 J08nY

Released: https://mypy-lang.blogspot.com/2022/09/mypy-0981-released.html

jhance avatar Sep 26 '22 18:09 jhance

Typo in the blogpost: I think add_button("OK", tight) # This works as well should be add_button("OK", **tight)

hauntsaninja avatar Sep 26 '22 19:09 hauntsaninja

Ugh, I fixed that for the kwargs elsewhere. It seems like the script we use to convert to html has some bug

I fixed the tight

jhance avatar Sep 26 '22 22:09 jhance

If we make a 0.982, we should take https://github.com/python/mypy/pull/13461

Caused issue reported here: https://github.com/python/mypy/issues/13750 and regression on typeshed: https://github.com/python/typeshed/pull/8796#discussion_r980582293 / https://github.com/python/mypy/pull/13303#issuecomment-1220342535

hauntsaninja avatar Sep 28 '22 00:09 hauntsaninja

Just curious what will be the release version after 0.990? 1.0?

JohnVillalovos avatar Sep 28 '22 04:09 JohnVillalovos