Skip to content

Commit 9772d48

Browse files
committed
Update changelog for release 1.14 (#18301)
As with all releases, I've omitted non user visible changes (e.g. refactoring, test-only changes) and trivial changes (e.g. fix typo) for individual list of PRs, but contributors should still be in the final "thanks" list.
1 parent 92473c8 commit 9772d48

File tree

1 file changed

+250
-2
lines changed

1 file changed

+250
-2
lines changed

CHANGELOG.md

+250-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## Next release
44

5+
...
6+
7+
## Mypy 1.14 (unreleased)
8+
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.
11+
You can install it as follows:
12+
13+
python3 -m pip install -U mypy
14+
15+
You can read the full documentation for this release on [Read the Docs](http://mypy.readthedocs.io).
16+
517
### Change to enum membership semantics
618

719
As per the updated [typing specification for enums](https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members),
@@ -39,8 +51,244 @@ class Pet(Enum):
3951
LION = ... # Member attribute with unknown value and unknown type
4052
```
4153

42-
Contributed by Terence Honles in PR [17207](https://github.com/python/mypy/pull/17207) and
43-
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)).
56+
57+
### Added support for @deprecated decorator (PEP 702)
58+
59+
Mypy can now issue errors or notes when code imports a deprecated feature
60+
explicitly with a `from mod import depr` statement, or uses a deprecated feature
61+
imported otherwise or defined locally. Features are considered deprecated when
62+
decorated with `warnings.deprecated`, as specified in [PEP 702](https://peps.python.org/pep-0702).
63+
64+
You can enable the error code via `--enable-error-code=deprecated` on the mypy
65+
command line or `enable_error_code = deprecated` in the mypy config file.
66+
Use the command line flag `--report-deprecated-as-note` or config file option
67+
`report_deprecated_as_note=True` to turn all such errors into notes.
68+
69+
Deprecation errors will be enabled by default in a future mypy version.
70+
71+
Contributed by Christoph Tyralla
72+
73+
List of changes:
74+
75+
* PEP 702 (@deprecated): descriptors (Christoph Tyralla, PR [18090](https://github.com/python/mypy/pull/18090))
76+
* Make "deprecated" Note a standard Error, disabled by default (Valentin Stanciu, PR [18192](https://github.com/python/mypy/pull/18192))
77+
* PEP 702 (@deprecated): consider all possible type positions (Christoph Tyralla, PR [17926](https://github.com/python/mypy/pull/17926))
78+
* PEP 702 (@deprecated): improve the handling of explicit type annotations of assignment statements (Christoph Tyralla, PR [17899](https://github.com/python/mypy/pull/17899))
79+
* Add basic support for PEP 702 (@deprecated). (Christoph Tyralla, PR [17476](https://github.com/python/mypy/pull/17476))
80+
81+
### Mypy can be configured to analyze untyped modules
82+
83+
Mypy normally doesn't analyze imports from modules without stubs or a py.typed marker.
84+
To force mypy to analyze these imports you can now set the `--follow-untyped-imports` command line
85+
flag or the `follow_untyped_imports` config file option to True. This can be set either in the
86+
global section of your mypy config file, or individually on a per-module basis.
87+
88+
Contributed by Jannick Kremer
89+
90+
List of changes:
91+
92+
* Implement flag to allow typechecking of untyped modules (Jannick Kremer, PR [17712](https://github.com/python/mypy/pull/17712))
93+
* Warn about --follow-untyped-imports (Shantanu, PR [18249](https://github.com/python/mypy/pull/18249))
94+
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+
131+
### Mypyc Improvements
132+
133+
* [mypyc] Document optimized bytes ops and additional str ops (Jukka Lehtosalo, PR [18242](https://github.com/python/mypy/pull/18242))
134+
* [mypyc] Add primitives and specialization for ord() (Jukka Lehtosalo, PR [18240](https://github.com/python/mypy/pull/18240))
135+
* [mypyc] Make exception type check in assertRaises test helper precise (Jukka Lehtosalo, PR [18241](https://github.com/python/mypy/pull/18241))
136+
* [mypyc] Optimize str.encode with specializations for common used encodings (Valentin Stanciu, PR [18232](https://github.com/python/mypy/pull/18232))
137+
* [mypyc] Refactor: use new-style primitives for unary and method ops (Jukka Lehtosalo, PR [18230](https://github.com/python/mypy/pull/18230))
138+
* [mypyc] Fixing condition to fall back to PyCall for staticmethod and classmethod (Advait Dixit, PR [18228](https://github.com/python/mypy/pull/18228))
139+
* [mypyc] Refactor: use new-style primitives for unary ops (Jukka Lehtosalo, PR [18213](https://github.com/python/mypy/pull/18213))
140+
* [mypyc] Refactor: use new-style primitives for function ops (Jukka Lehtosalo, PR [18211](https://github.com/python/mypy/pull/18211))
141+
* [mypyc] Support unicode surrogates in string literals (Jukka Lehtosalo, PR [18209](https://github.com/python/mypy/pull/18209))
142+
* [mypyc] Fixing index variable in for-loop with builtins.enumerate. (Advait Dixit, PR [18202](https://github.com/python/mypy/pull/18202))
143+
* [mypyc] Fixing check for enum classes. (Advait Dixit, PR [18178](https://github.com/python/mypy/pull/18178))
144+
* [mypyc] Loading type from imported modules. (Advait Dixit, PR [18158](https://github.com/python/mypy/pull/18158))
145+
* [mypyc] Fix is_native_ref_expr for class attrs (Jared Hance, PR [18031](https://github.com/python/mypy/pull/18031))
146+
* [mypyc] fix name generation for modules with similar full names (aatle, PR [18001](https://github.com/python/mypy/pull/18001))
147+
* [mypyc] fix relative imports in __init__.py (Shantanu, PR [17979](https://github.com/python/mypy/pull/17979))
148+
* [mypyc] Optimize dunder methods (jairov4, PR [17934](https://github.com/python/mypy/pull/17934))
149+
* [mypyc] Replace deprecated _PyDict_GetItemStringWithError (Marc Mueller, PR [17930](https://github.com/python/mypy/pull/17930))
150+
* [mypyc] Fix wheel build for cp313-win (Marc Mueller, PR [17941](https://github.com/python/mypy/pull/17941))
151+
* [mypyc] Use PyGen_GetCode in gen_is_coroutine (Marc Mueller, PR [17931](https://github.com/python/mypy/pull/17931))
152+
* [mypyc] Optimize calls to final classes (jairov4, PR [17886](https://github.com/python/mypy/pull/17886))
153+
* [mypyc] Support ellipsis (...) expressions in class bodies (Newbyte, PR [17923](https://github.com/python/mypy/pull/17923))
154+
* [mypyc] Sync pythoncapi_compat.h (Marc Mueller, PR [17929](https://github.com/python/mypy/pull/17929))
155+
* [mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (Jukka Lehtosalo, PR [17906](https://github.com/python/mypy/pull/17906))
156+
* [mypyc] Make C unit tests faster by compiling with -O0 (Jukka Lehtosalo, PR [17884](https://github.com/python/mypy/pull/17884))
157+
158+
### Stubgen improvements
159+
160+
* stubgen: do not include mypy generated symbols (Ali Hamdan, PR [18137](https://github.com/python/mypy/pull/18137))
161+
* stubgen: fix FunctionContext.fullname for nested classes (Chad Dombrova, PR [17963](https://github.com/python/mypy/pull/17963))
162+
* stubgen: Add flagfile support (Ruslan Sayfutdinov, PR [18061](https://github.com/python/mypy/pull/18061))
163+
* stubgen: add support for PEPs 695 and 696 syntax (Ali Hamdan, PR [18054](https://github.com/python/mypy/pull/18054))
164+
165+
### Stubtest improvements
166+
167+
* allow the use of --show-traceback and --pdb with stubtest (Stephen Morton, PR [18037](https://github.com/python/mypy/pull/18037))
168+
* [stubtest] Verify __all__ exists in stub (Sebastian Rittau, PR [18005](https://github.com/python/mypy/pull/18005))
169+
* stubtest: Stop telling people to use double underscores (Jelle Zijlstra, PR [17897](https://github.com/python/mypy/pull/17897))
170+
171+
### Documentation Updates
172+
173+
* Fixed typo in extending mypy docs. (Carlton Gibson, PR [18234](https://github.com/python/mypy/pull/18234))
174+
* Update `config_file` docs (sobolevn, PR [18103](https://github.com/python/mypy/pull/18103))
175+
* Update for Windows platform. Resolves #18096 (ag-tafe, PR [18097](https://github.com/python/mypy/pull/18097))
176+
* Correct note about `--disallow-any-generics` flag in docs (Abel Sen, PR [18055](https://github.com/python/mypy/pull/18055))
177+
* Further caution against `--follow-imports=skip` (Shantanu, PR [18048](https://github.com/python/mypy/pull/18048))
178+
* [docs] fix broken markup in `type_narrowing.rst` (vasiliy, PR [18028](https://github.com/python/mypy/pull/18028))
179+
* [docs] automatic copyright year update (chiri, PR [17982](https://github.com/python/mypy/pull/17982))
180+
* [docs] fix the edit page buttton link in docs (Kanishk Pachauri, PR [17933](https://github.com/python/mypy/pull/17933))
181+
182+
### Other Notables Fixes and Improvements
183+
184+
* Show `Protocol` `__call__` for arguments with incompatible types (MechanicalConstruct, PR [18214](https://github.com/python/mypy/pull/18214))
185+
* Make join and meet symmetric with strict_optional (MechanicalConstruct, PR [18227](https://github.com/python/mypy/pull/18227))
186+
* Preserve block unreachablility when checking function definitions with constrained TypeVars (Brian Schubert, PR [18217](https://github.com/python/mypy/pull/18217))
187+
* Do not include non-init fields in the synthesized `__replace__` method for dataclasses (Victorien, PR [18221](https://github.com/python/mypy/pull/18221))
188+
* Disallow `TypeVar` constraints parameterized by type variables (Brian Schubert, PR [18186](https://github.com/python/mypy/pull/18186))
189+
* Refactor: merge duplicate HasTypeVars query visitors (Brian Schubert, PR [18222](https://github.com/python/mypy/pull/18222))
190+
* Always complain about invalid varargs and varkwargs (Shantanu, PR [18207](https://github.com/python/mypy/pull/18207))
191+
* Set default strict_optional state to True (Shantanu, PR [18198](https://github.com/python/mypy/pull/18198))
192+
* Preserve typevar default None in type alias (Sukhorosov Aleksey, PR [18197](https://github.com/python/mypy/pull/18197))
193+
* Added checks for invalid usage of continue/break/return in except* block (coldwolverine, PR [18132](https://github.com/python/mypy/pull/18132))
194+
* Do not consider bare TypeVar not overlapping with None for reachability analysis (Stanislav Terliakov, PR [18138](https://github.com/python/mypy/pull/18138))
195+
* Special case types.DynamicClassAttribute as property-like (Stephen Morton, PR [18150](https://github.com/python/mypy/pull/18150))
196+
* Disallow bare `ParamSpec` in type aliases (Brian Schubert, PR [18174](https://github.com/python/mypy/pull/18174))
197+
* Move long_description metadata to pyproject.toml (Marc Mueller, PR [18172](https://github.com/python/mypy/pull/18172))
198+
* Support `==`-based narrowing of Optional (Christoph Tyralla, PR [18163](https://github.com/python/mypy/pull/18163))
199+
* Allow TypedDict assignment of Required item to NotRequired ReadOnly item (Brian Schubert, PR [18164](https://github.com/python/mypy/pull/18164))
200+
* Allow nesting of Annotated with TypedDict special forms inside TypedDicts (Brian Schubert, PR [18165](https://github.com/python/mypy/pull/18165))
201+
* Infer generic type arguments for slice expressions (Brian Schubert, PR [18160](https://github.com/python/mypy/pull/18160))
202+
* Fix checking of match sequence pattern against bounded type variables (Brian Schubert, PR [18091](https://github.com/python/mypy/pull/18091))
203+
* Fix incorrect truthyness for Enum types and literals (David Salvisberg, PR [17337](https://github.com/python/mypy/pull/17337))
204+
* Move static project metadata to pyproject.toml (Marc Mueller, PR [18146](https://github.com/python/mypy/pull/18146))
205+
* Fallback to stdlib json if integer exceeds 64-bit range (q0w, PR [18148](https://github.com/python/mypy/pull/18148))
206+
* Fix `OR` pattern structural matching exhaustiveness (yihong, PR [18119](https://github.com/python/mypy/pull/18119))
207+
* Fix type inference of positional parameter in class pattern involving builtin subtype (Brian Schubert, PR [18141](https://github.com/python/mypy/pull/18141))
208+
* Fix [override] error with no line number when argument node has no line number (Brian Schubert, PR [18122](https://github.com/python/mypy/pull/18122))
209+
* Fix typos in `generics.rst` (yihong, PR [18110](https://github.com/python/mypy/pull/18110))
210+
* Fix couple crashes in dmypy (Ivan Levkivskyi, PR [18098](https://github.com/python/mypy/pull/18098))
211+
* Fix subtyping between Instance and Overloaded (Shantanu, PR [18102](https://github.com/python/mypy/pull/18102))
212+
* Clean up new_semantic_analyzer config (Shantanu, PR [18071](https://github.com/python/mypy/pull/18071))
213+
* Issue warning for enum with no members in stub (Shantanu, PR [18068](https://github.com/python/mypy/pull/18068))
214+
* Fix enum attributes are not members (Terence Honles, PR [17207](https://github.com/python/mypy/pull/17207))
215+
* Fix crash when checking slice expression with step 0 in tuple index (Brian Schubert, PR [18063](https://github.com/python/mypy/pull/18063))
216+
* Allow union-with-callable attributes to be overridden by methods (Brian Schubert, PR [18018](https://github.com/python/mypy/pull/18018))
217+
* Emit `[mutable-override]` for covariant override of attribute with method (Brian Schubert, PR [18058](https://github.com/python/mypy/pull/18058))
218+
* Support ParamSpec mapping with functools.partial (Stanislav Terliakov, PR [17355](https://github.com/python/mypy/pull/17355))
219+
* Fix approved stub ignore, remove normpath (Shantanu, PR [18045](https://github.com/python/mypy/pull/18045))
220+
* Make `disallow-any-unimported` flag invertible (Séamus Ó Ceanainn, PR [18030](https://github.com/python/mypy/pull/18030))
221+
* Filter to possible package paths before trying to resolve a module (falsedrow, PR [18038](https://github.com/python/mypy/pull/18038))
222+
* Refactor type narrowing further (Jukka Lehtosalo, PR [18043](https://github.com/python/mypy/pull/18043))
223+
* Refactor "==" and "is" type narrowing logic (Jukka Lehtosalo, PR [18042](https://github.com/python/mypy/pull/18042))
224+
* Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR [18040](https://github.com/python/mypy/pull/18040))
225+
* Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR [18033](https://github.com/python/mypy/pull/18033))
226+
* Fix ternary union for literals (Ivan Levkivskyi, PR [18023](https://github.com/python/mypy/pull/18023))
227+
* Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR [18020](https://github.com/python/mypy/pull/18020))
228+
* Add timeout-minutes to ci config (Marc Mueller, PR [18003](https://github.com/python/mypy/pull/18003))
229+
* TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR [17145](https://github.com/python/mypy/pull/17145))
230+
* Fix cache-convert (Shantanu, PR [17974](https://github.com/python/mypy/pull/17974))
231+
* Fix generator comprehension in meet.py (Shantanu, PR [17969](https://github.com/python/mypy/pull/17969))
232+
* fix crash issue when using shadowfile with pretty #17853 (Max Chang, PR [17894](https://github.com/python/mypy/pull/17894))
233+
* [PEP 695] Fix multiple nested classes don't work (Max Chang, PR [17820](https://github.com/python/mypy/pull/17820))
234+
* Better error for `mypy -p package` without py.typed (Joe Gordon, PR [17908](https://github.com/python/mypy/pull/17908))
235+
* Emit error for "raise NotImplemented" (Brian Schubert, PR [17890](https://github.com/python/mypy/pull/17890))
236+
* Add is_lvalue attribute to AttributeContext (Brian Schubert, PR [17881](https://github.com/python/mypy/pull/17881))
237+
238+
### Acknowledgements
239+
240+
Thanks to all mypy contributors who contributed to this release:
241+
242+
- aatle
243+
- Abel Sen
244+
- Advait Dixit
245+
- ag-tafe
246+
- Alex Waygood
247+
- Ali Hamdan
248+
- Brian Schubert
249+
- Carlton Gibson
250+
- Chad Dombrova
251+
- Chelsea Durazo
252+
- chiri
253+
- Christoph Tyralla
254+
- coldwolverine
255+
- David Salvisberg
256+
- Ekin Dursun
257+
- Evgeniy Slobodkin
258+
- falsedrow
259+
- Gaurav Giri
260+
- Ihor
261+
- Ivan Levkivskyi
262+
- jairov4
263+
- Jannick Kremer
264+
- Jelle Zijlstra
265+
- jhance
266+
- jianghuyiyuan
267+
- Joe Gordon
268+
- John Doknjas
269+
- Jukka Lehtosalo
270+
- Kanishk Pachauri
271+
- Marc Mueller
272+
- Max Chang
273+
- MechanicalConstruct
274+
- Newbyte
275+
- q0w
276+
- Ruslan Sayfutdinov
277+
- Sebastian Rittau
278+
- Shantanu
279+
- sobolevn
280+
- Stanislav Terliakov
281+
- Stephen Morton
282+
- Sukhorosov Aleksey
283+
- Séamus Ó Ceanainn
284+
- Terence Honles
285+
- Valentin Stanciu
286+
- vasiliy
287+
- Victorien
288+
- yihong
289+
290+
I’d also like to thank my employer, Dropbox, for supporting mypy development.
291+
44292

45293
## Mypy 1.13
46294

0 commit comments

Comments
 (0)