From 62d7f22e9891b91f8e27de4c53a1777939a63782 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 10 Nov 2023 11:13:07 +0000 Subject: [PATCH 1/4] Include recent cherry-picks --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc8e4714423..9abb6b5a330e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ TypeVarTuple was implemented by Jared Hance and Ivan Levkivskyi over several myp Changes included in this release: + * Handle TypeVarTuples when checking overload constraints (robjhornby, PR [16428](https://github.com/python/mypy/pull/16428)) * Enable Unpack/TypeVarTuple support (Ivan Levkivskyi, PR [16354](https://github.com/python/mypy/pull/16354)) * Fix crash on unpack call special-casing (Ivan Levkivskyi, PR [16381](https://github.com/python/mypy/pull/16381)) * Some final touches for variadic types support (Ivan Levkivskyi, PR [16334](https://github.com/python/mypy/pull/16334)) @@ -175,6 +176,7 @@ This was contributed by Shantanu (PR [16280](https://github.com/python/mypy/pull #### Other Notable Changes and Fixes + * Fix type narrowing in lambda expressions (Ivan Levkivskyi, PR [16407](https://github.com/python/mypy/pull/16407)) * Avoid importing from `setuptools._distutils` (Shantanu, PR [16348](https://github.com/python/mypy/pull/16348)) * Delete recursive aliases flags (Ivan Levkivskyi, PR [16346](https://github.com/python/mypy/pull/16346)) * Properly use proper subtyping for callables (Ivan Levkivskyi, PR [16343](https://github.com/python/mypy/pull/16343)) From 55b3701d8c058f05aaee15e4800b9b66a4a6d436 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 10 Nov 2023 11:14:17 +0000 Subject: [PATCH 2/4] Update wording --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9abb6b5a330e..5aad72f7d267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -176,7 +176,7 @@ This was contributed by Shantanu (PR [16280](https://github.com/python/mypy/pull #### Other Notable Changes and Fixes - * Fix type narrowing in lambda expressions (Ivan Levkivskyi, PR [16407](https://github.com/python/mypy/pull/16407)) + * Propagate narrowed types to lambda expressions (Ivan Levkivskyi, PR [16407](https://github.com/python/mypy/pull/16407)) * Avoid importing from `setuptools._distutils` (Shantanu, PR [16348](https://github.com/python/mypy/pull/16348)) * Delete recursive aliases flags (Ivan Levkivskyi, PR [16346](https://github.com/python/mypy/pull/16346)) * Properly use proper subtyping for callables (Ivan Levkivskyi, PR [16343](https://github.com/python/mypy/pull/16343)) From 70dc24dfacc1ebee347564528708494b05f6c2fb Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 10 Nov 2023 11:35:28 +0000 Subject: [PATCH 3/4] Update changelog for 1.7 --- CHANGELOG.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aad72f7d267..9d2cd68b22ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,14 @@ foo(name="x", age=1) # Ok foo(name=1) # Error ``` -Refer to [PEP 692](https://peps.python.org/pep-0692/) for the details. +The definition of `foo` above is equivalent to the one below, with keyword-only arguments `name` and `age`: + +``` +def foo(*, name: str, age: int) -> None: + ... +``` + +Refer to [PEP 692](https://peps.python.org/pep-0692/) for more information. Note that unlike in the current version of the PEP, mypy always treats signatures with `Unpack[SomeTypedDict]` as equivalent to their expanded forms with explicit keyword arguments, and there aren't special type checking rules for TypedDict arguments. This was contributed by Ivan Levkivskyi back in 2022 ([PR 13471](https://github.com/python/mypy/pull/13471)). @@ -97,6 +104,14 @@ def f(t: tuple[int, int] | tuple[int, int, int]) -> None: This feature was contributed by Ivan Levkivskyi (PR [16237](https://github.com/python/mypy/pull/16237)). +#### More Precise Tuple Lenghts (Experimental) + +Mypy supports experimental, more precise checking of tuple type lengths through `--enable-incomplete-feature=PreciseTupleTypes`. Refer to the [documentation](https://mypy.readthedocs.io/en/latest/command_line.html#enabling-incomplete-experimental-features) for more information. + +More generally, we are planning to use `--enable-incomplete-feature` to introduce experimental features that would benefit from community feedback. + +This feature was contributed by Ivan Levkivskyi (PR [16237](https://github.com/python/mypy/pull/16237)). + #### Mypy Changelog We now maintain a [changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) in the mypy Git repository. It mirrors the contents of [mypy release blog posts](https://mypy-lang.blogspot.com/). We will continue to also publish release blog posts. In the future, release blog posts will be created based on the changelog near a release date. From 39f1d771ad322bea34598bb8fcf84b2d12374054 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 10 Nov 2023 11:41:36 +0000 Subject: [PATCH 4/4] Mention another cherry-picked PR in the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2cd68b22ea..9b3cd19e6df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ TypeVarTuple was implemented by Jared Hance and Ivan Levkivskyi over several myp Changes included in this release: + * Fix handling of tuple type context with unpacks (Ivan Levkivskyi, PR [16444](https://github.com/python/mypy/pull/16444)) * Handle TypeVarTuples when checking overload constraints (robjhornby, PR [16428](https://github.com/python/mypy/pull/16428)) * Enable Unpack/TypeVarTuple support (Ivan Levkivskyi, PR [16354](https://github.com/python/mypy/pull/16354)) * Fix crash on unpack call special-casing (Ivan Levkivskyi, PR [16381](https://github.com/python/mypy/pull/16381))