Skip to content

Commit 093b4a1

Browse files
committed
Add 2 more sections per comments
1 parent 8870d43 commit 093b4a1

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

CHANGELOG.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
## Mypy 1.14 (unreleased)
88

9-
We’ve just uploaded mypy 1.14 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). Mypy is a static type
10-
checker for Python. This release includes new features and bug fixes.
9+
We’ve just uploaded mypy 1.14 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)).
10+
Mypy is a static type checker for Python. This release includes new features and bug fixes.
1111
You can install it as follows:
1212

1313
python3 -m pip install -U mypy
@@ -51,8 +51,8 @@ class Pet(Enum):
5151
LION = ... # Member attribute with unknown value and unknown type
5252
```
5353

54-
Contributed by Terence Honles in PR [17207](https://github.com/python/mypy/pull/17207) and
55-
Shantanu Jain in PR [18068](https://github.com/python/mypy/pull/18068).
54+
Contributed by Terence Honles (PR [17207](https://github.com/python/mypy/pull/17207)) and
55+
Shantanu Jain (PR [18068](https://github.com/python/mypy/pull/18068)).
5656

5757
### Added support for @deprecated decorator (PEP 702)
5858

@@ -88,9 +88,46 @@ global section of your mypy config file, or individually on a per-module basis.
8888
Contributed by Jannick Kremer
8989

9090
List of changes:
91+
9192
* Implement flag to allow typechecking of untyped modules (Jannick Kremer, PR [17712](https://github.com/python/mypy/pull/17712))
9293
* Warn about --follow-untyped-imports (Shantanu, PR [18249](https://github.com/python/mypy/pull/18249))
9394

95+
### Added support for new style TypeVar Defaults (PEP 696)
96+
97+
Mypy now supports TypeVar defaults using the new syntax described in PEP 696, that was introduced in Python 3.13.
98+
99+
```python
100+
@dataclass
101+
class Box[T = int]:
102+
value: T | None = None
103+
104+
reveal_type(Box()) # type is Box[int], since it's the default
105+
reveal_type(Box(value="Hello World!")) # type is Box[str]
106+
```
107+
108+
Contributed by Marc Mueller (PR [17985](https://github.com/python/mypy/pull/17985))
109+
110+
### Improved for loop index variable type narrowing
111+
112+
Mypy now preserves the literal type of index expressions until the next assignment to support `TypedDict` lookups.
113+
114+
```python
115+
from typing import TypedDict
116+
117+
class X(TypedDict):
118+
hourly: int
119+
daily: int
120+
121+
def func(x: X) -> int:
122+
s = 0
123+
for var in ("hourly", "daily"):
124+
reveal_type(var) # Revealed type is "Union[Literal['hourly']?, Literal['daily']?]"
125+
s += x[var] # x[var] would previously cause a literal-required error
126+
return s
127+
```
128+
129+
Contributed by Marc Mueller (PR [18014](https://github.com/python/mypy/pull/18014))
130+
94131
### Mypyc Improvements
95132

96133
* [mypyc] Document optimized bytes ops and additional str ops (Jukka Lehtosalo, PR [18242](https://github.com/python/mypy/pull/18242))
@@ -187,10 +224,8 @@ List of changes:
187224
* Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR [18040](https://github.com/python/mypy/pull/18040))
188225
* Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR [18033](https://github.com/python/mypy/pull/18033))
189226
* Fix ternary union for literals (Ivan Levkivskyi, PR [18023](https://github.com/python/mypy/pull/18023))
190-
* Improve for loop index variable type narrowing (Marc Mueller, PR [18014](https://github.com/python/mypy/pull/18014))
191227
* Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR [18020](https://github.com/python/mypy/pull/18020))
192228
* Add timeout-minutes to ci config (Marc Mueller, PR [18003](https://github.com/python/mypy/pull/18003))
193-
* Add initial support for new style TypeVar defaults (PEP 696) (Marc Mueller, PR [17985](https://github.com/python/mypy/pull/17985))
194229
* TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR [17145](https://github.com/python/mypy/pull/17145))
195230
* Fix cache-convert (Shantanu, PR [17974](https://github.com/python/mypy/pull/17974))
196231
* Fix generator comprehension in meet.py (Shantanu, PR [17969](https://github.com/python/mypy/pull/17969))

0 commit comments

Comments
 (0)