|
2 | 2 |
|
3 | 3 | ## Next release |
4 | 4 |
|
| 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/)). Mypy is a static type |
| 10 | +checker for Python. This release includes new features, performance improvements 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 | + |
5 | 17 | ### Change to enum membership semantics |
6 | 18 |
|
7 | 19 | As per the updated [typing specification for enums](https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members), |
@@ -42,6 +54,196 @@ class Pet(Enum): |
42 | 54 | Contributed by Terence Honles in PR [17207](https://github.com/python/mypy/pull/17207) and |
43 | 55 | Shantanu Jain in PR [18068](https://github.com/python/mypy/pull/18068). |
44 | 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, 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 option `--report-deprecated-as-note` to turn all such errors into notes. |
| 67 | + |
| 68 | +Will be enabled by default in a future mypy version. |
| 69 | + |
| 70 | +Contributed by Christoph Tyralla |
| 71 | + |
| 72 | +List of changes: |
| 73 | + |
| 74 | + * PEP 702 (@deprecated): descriptors (Christoph Tyralla, PR [18090](https://github.com/python/mypy/pull/18090)) |
| 75 | + * Make "deprecated" Note a standard Error, disabled by default (Valentin Stanciu, PR [18192](https://github.com/python/mypy/pull/18192)) |
| 76 | + * PEP 702 (@deprecated): consider all possible type positions (Christoph Tyralla, PR [17926](https://github.com/python/mypy/pull/17926)) |
| 77 | + * PEP 702 (@deprecated): improve the handling of explicit type annotations of assignment statements (Christoph Tyralla, PR [17899](https://github.com/python/mypy/pull/17899)) |
| 78 | + * Add basic support for PEP 702 (@deprecated). (Christoph Tyralla, PR [17476](https://github.com/python/mypy/pull/17476)) |
| 79 | + |
| 80 | + |
| 81 | +### Mypyc Improvements |
| 82 | + |
| 83 | + * [mypyc] Document optimized bytes ops and additional str ops (Jukka Lehtosalo, PR [18242](https://github.com/python/mypy/pull/18242)) |
| 84 | + * [mypyc] Add primitives and specialization for ord() (Jukka Lehtosalo, PR [18240](https://github.com/python/mypy/pull/18240)) |
| 85 | + * [mypyc] Make exception type check in assertRaises test helper precise (Jukka Lehtosalo, PR [18241](https://github.com/python/mypy/pull/18241)) |
| 86 | + * [mypyc] Optimize str.encode with specializations for common used encodings (Valentin Stanciu, PR [18232](https://github.com/python/mypy/pull/18232)) |
| 87 | + * [mypyc] Refactor: use new-style primitives for unary and method ops (Jukka Lehtosalo, PR [18230](https://github.com/python/mypy/pull/18230)) |
| 88 | + * [mypyc] Fixing condition to fall back to PyCall for staticmethod and classmethod (Advait Dixit, PR [18228](https://github.com/python/mypy/pull/18228)) |
| 89 | + * [mypyc] Refactor: use new-style primitives for unary ops (Jukka Lehtosalo, PR [18213](https://github.com/python/mypy/pull/18213)) |
| 90 | + * [mypyc] Refactor: use new-style primitives for function ops (Jukka Lehtosalo, PR [18211](https://github.com/python/mypy/pull/18211)) |
| 91 | + * [mypyc] Support unicode surrogates in string literals (Jukka Lehtosalo, PR [18209](https://github.com/python/mypy/pull/18209)) |
| 92 | + * [mypyc] Fixing index variable in for-loop with builtins.enumerate. (Advait Dixit, PR [18202](https://github.com/python/mypy/pull/18202)) |
| 93 | + * [mypyc] Fixing check for enum classes. (Advait Dixit, PR [18178](https://github.com/python/mypy/pull/18178)) |
| 94 | + * [mypyc] Loading type from imported modules. (Advait Dixit, PR [18158](https://github.com/python/mypy/pull/18158)) |
| 95 | + * [mypyc] Fix is_native_ref_expr for class attrs (Jared Hance, PR [18031](https://github.com/python/mypy/pull/18031)) |
| 96 | + * [mypyc] fix name generation for modules with similar full names (aatle, PR [18001](https://github.com/python/mypy/pull/18001)) |
| 97 | + * [mypyc] fix relative imports in __init__.py (Shantanu, PR [17979](https://github.com/python/mypy/pull/17979)) |
| 98 | + * [mypyc] Optimize dunder methods (jairov4, PR [17934](https://github.com/python/mypy/pull/17934)) |
| 99 | + * [mypyc] Replace deprecated _PyDict_GetItemStringWithError (Marc Mueller, PR [17930](https://github.com/python/mypy/pull/17930)) |
| 100 | + * [mypyc] Fix wheel build for cp313-win (Marc Mueller, PR [17941](https://github.com/python/mypy/pull/17941)) |
| 101 | + * [mypyc] Use PyGen_GetCode in gen_is_coroutine (Marc Mueller, PR [17931](https://github.com/python/mypy/pull/17931)) |
| 102 | + * [mypyc] Optimize calls to final classes (jairov4, PR [17886](https://github.com/python/mypy/pull/17886)) |
| 103 | + * [mypyc] Support ellipsis (...) expressions in class bodies (Newbyte, PR [17923](https://github.com/python/mypy/pull/17923)) |
| 104 | + * [mypyc] Sync pythoncapi_compat.h (Marc Mueller, PR [17929](https://github.com/python/mypy/pull/17929)) |
| 105 | + * [mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (Jukka Lehtosalo, PR [17906](https://github.com/python/mypy/pull/17906)) |
| 106 | + * [mypyc] Make C unit tests faster by compiling with -O0 (Jukka Lehtosalo, PR [17884](https://github.com/python/mypy/pull/17884)) |
| 107 | + |
| 108 | +### Stubgen improvements |
| 109 | + |
| 110 | + * stubgen: do not include mypy generated symbols (Ali Hamdan, PR [18137](https://github.com/python/mypy/pull/18137)) |
| 111 | + * stubgen: fix FunctionContext.fullname for nested classes (Chad Dombrova, PR [17963](https://github.com/python/mypy/pull/17963)) |
| 112 | + * stubgen: Add flagfile support (Ruslan Sayfutdinov, PR [18061](https://github.com/python/mypy/pull/18061)) |
| 113 | + * stubgen: add support for PEPs 695 and 696 syntax (Ali Hamdan, PR [18054](https://github.com/python/mypy/pull/18054)) |
| 114 | + |
| 115 | +### Stubtest improvements |
| 116 | + |
| 117 | + * allow the use of --show-traceback and --pdb with stubtest (Stephen Morton, PR [18037](https://github.com/python/mypy/pull/18037)) |
| 118 | + * [stubtest] Verify __all__ exists in stub (Sebastian Rittau, PR [18005](https://github.com/python/mypy/pull/18005)) |
| 119 | + * stubtest: Stop telling people to use double underscores (Jelle Zijlstra, PR [17897](https://github.com/python/mypy/pull/17897)) |
| 120 | + |
| 121 | +### Documentation Updates |
| 122 | + |
| 123 | + * Fixed typo in extending mypy docs. (Carlton Gibson, PR [18234](https://github.com/python/mypy/pull/18234)) |
| 124 | + * Update `config_file` docs (sobolevn, PR [18103](https://github.com/python/mypy/pull/18103)) |
| 125 | + * Update for Windows platform. Resolves #18096 (ag-tafe, PR [18097](https://github.com/python/mypy/pull/18097)) |
| 126 | + * Correct note about `--disallow-any-generics` flag in docs (Abel Sen, PR [18055](https://github.com/python/mypy/pull/18055)) |
| 127 | + * Further caution against `--follow-imports=skip` (Shantanu, PR [18048](https://github.com/python/mypy/pull/18048)) |
| 128 | + * [docs] fix broken markup in `type_narrowing.rst` (vasiliy, PR [18028](https://github.com/python/mypy/pull/18028)) |
| 129 | + * [docs] automatic copyright year update (chiri, PR [17982](https://github.com/python/mypy/pull/17982)) |
| 130 | + * [docs] fix the edit page buttton link in docs (Kanishk Pachauri, PR [17933](https://github.com/python/mypy/pull/17933)) |
| 131 | + |
| 132 | +### Other Notables Fixes and Improvements |
| 133 | + |
| 134 | + * Implement flag to allow typechecking of untyped modules (Jannick Kremer, PR [17712](https://github.com/python/mypy/pull/17712)) |
| 135 | + * Show Protocol __call__ for arguments with incompatible types (MechanicalConstruct, PR [18214](https://github.com/python/mypy/pull/18214)) |
| 136 | + * Make join and meet symmetric with strict_optional (MechanicalConstruct, PR [18227](https://github.com/python/mypy/pull/18227)) |
| 137 | + * Preserve block unreachablility when checking function definitions with constrained TypeVars (Brian Schubert, PR [18217](https://github.com/python/mypy/pull/18217)) |
| 138 | + * Do not include non-init fields in the synthesized `__replace__` method for dataclasses (Victorien, PR [18221](https://github.com/python/mypy/pull/18221)) |
| 139 | + * Disallow `TypeVar` constraints parameterized by type variables (Brian Schubert, PR [18186](https://github.com/python/mypy/pull/18186)) |
| 140 | + * Refactor: merge duplicate HasTypeVars query visitors (Brian Schubert, PR [18222](https://github.com/python/mypy/pull/18222)) |
| 141 | + * Always complain about invalid varargs and varkwargs (Shantanu, PR [18207](https://github.com/python/mypy/pull/18207)) |
| 142 | + * Set default strict_optional state to True (Shantanu, PR [18198](https://github.com/python/mypy/pull/18198)) |
| 143 | + * Preserve typevar default None in type alias (Sukhorosov Aleksey, PR [18197](https://github.com/python/mypy/pull/18197)) |
| 144 | + * Added checks for invalid usage of continue/break/return in except* block (coldwolverine, PR [18132](https://github.com/python/mypy/pull/18132)) |
| 145 | + * Do not consider bare TypeVar not overlapping with None for reachability analysis (Stanislav Terliakov, PR [18138](https://github.com/python/mypy/pull/18138)) |
| 146 | + * Special case types.DynamicClassAttribute as property-like (Stephen Morton, PR [18150](https://github.com/python/mypy/pull/18150)) |
| 147 | + * Disallow bare `ParamSpec` in type aliases (Brian Schubert, PR [18174](https://github.com/python/mypy/pull/18174)) |
| 148 | + * Move long_description metadata to pyproject.toml (Marc Mueller, PR [18172](https://github.com/python/mypy/pull/18172)) |
| 149 | + * Support `==`-based narrowing of Optional (Christoph Tyralla, PR [18163](https://github.com/python/mypy/pull/18163)) |
| 150 | + * Allow TypedDict assignment of Required item to NotRequired ReadOnly item (Brian Schubert, PR [18164](https://github.com/python/mypy/pull/18164)) |
| 151 | + * Allow nesting of Annotated with TypedDict special forms inside TypedDicts (Brian Schubert, PR [18165](https://github.com/python/mypy/pull/18165)) |
| 152 | + * Infer generic type arguments for slice expressions (Brian Schubert, PR [18160](https://github.com/python/mypy/pull/18160)) |
| 153 | + * Fix checking of match sequence pattern against bounded type variables (Brian Schubert, PR [18091](https://github.com/python/mypy/pull/18091)) |
| 154 | + * Fix incorrect truthyness for Enum types and literals (David Salvisberg, PR [17337](https://github.com/python/mypy/pull/17337)) |
| 155 | + * Move static project metadata to pyproject.toml (Marc Mueller, PR [18146](https://github.com/python/mypy/pull/18146)) |
| 156 | + * Fallback to stdlib json if integer exceeds 64-bit range (q0w, PR [18148](https://github.com/python/mypy/pull/18148)) |
| 157 | + * Fix `OR` pattern structural matching exhaustiveness (yihong, PR [18119](https://github.com/python/mypy/pull/18119)) |
| 158 | + * Fix type inference of positional parameter in class pattern involving builtin subtype (Brian Schubert, PR [18141](https://github.com/python/mypy/pull/18141)) |
| 159 | + * 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)) |
| 160 | + * Fix typos in `generics.rst` (yihong, PR [18110](https://github.com/python/mypy/pull/18110)) |
| 161 | + * Fix couple crashes in dmypy (Ivan Levkivskyi, PR [18098](https://github.com/python/mypy/pull/18098)) |
| 162 | + * Fix subtyping between Instance and Overloaded (Shantanu, PR [18102](https://github.com/python/mypy/pull/18102)) |
| 163 | + * Clean up new_semantic_analyzer config (Shantanu, PR [18071](https://github.com/python/mypy/pull/18071)) |
| 164 | + * Issue warning for enum with no members in stub (Shantanu, PR [18068](https://github.com/python/mypy/pull/18068)) |
| 165 | + * Fix enum attributes are not members (Terence Honles, PR [17207](https://github.com/python/mypy/pull/17207)) |
| 166 | + * Fix crash when checking slice expression with step 0 in tuple index (Brian Schubert, PR [18063](https://github.com/python/mypy/pull/18063)) |
| 167 | + * Allow union-with-callable attributes to be overridden by methods (Brian Schubert, PR [18018](https://github.com/python/mypy/pull/18018)) |
| 168 | + * Emit `[mutable-override]` for covariant override of attribute with method (Brian Schubert, PR [18058](https://github.com/python/mypy/pull/18058)) |
| 169 | + * Support ParamSpec mapping with functools.partial (Stanislav Terliakov, PR [17355](https://github.com/python/mypy/pull/17355)) |
| 170 | + * Fix approved stub ignore, remove normpath (Shantanu, PR [18045](https://github.com/python/mypy/pull/18045)) |
| 171 | + * Make `disallow-any-unimported` flag invertible (Séamus Ó Ceanainn, PR [18030](https://github.com/python/mypy/pull/18030)) |
| 172 | + * Filter to possible package paths before trying to resolve a module (falsedrow, PR [18038](https://github.com/python/mypy/pull/18038)) |
| 173 | + * Refactor type narrowing further (Jukka Lehtosalo, PR [18043](https://github.com/python/mypy/pull/18043)) |
| 174 | + * Refactor "==" and "is" type narrowing logic (Jukka Lehtosalo, PR [18042](https://github.com/python/mypy/pull/18042)) |
| 175 | + * Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR [18040](https://github.com/python/mypy/pull/18040)) |
| 176 | + * Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR [18033](https://github.com/python/mypy/pull/18033)) |
| 177 | + * Fix ternary union for literals (Ivan Levkivskyi, PR [18023](https://github.com/python/mypy/pull/18023)) |
| 178 | + * Improve for loop index variable type narrowing (Marc Mueller, PR [18014](https://github.com/python/mypy/pull/18014)) |
| 179 | + * Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR [18020](https://github.com/python/mypy/pull/18020)) |
| 180 | + * Add timeout-minutes to ci config (Marc Mueller, PR [18003](https://github.com/python/mypy/pull/18003)) |
| 181 | + * Add initial support for new style TypeVar defaults (PEP 696) (Marc Mueller, PR [17985](https://github.com/python/mypy/pull/17985)) |
| 182 | + * TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR [17145](https://github.com/python/mypy/pull/17145)) |
| 183 | + * Fix cache-convert (Shantanu, PR [17974](https://github.com/python/mypy/pull/17974)) |
| 184 | + * Fix generator comprehension in meet.py (Shantanu, PR [17969](https://github.com/python/mypy/pull/17969)) |
| 185 | + * fix crash issue when using shadowfile with pretty #17853 (Max Chang, PR [17894](https://github.com/python/mypy/pull/17894)) |
| 186 | + * [PEP 695] Fix multiple nested classes don't work (Max Chang, PR [17820](https://github.com/python/mypy/pull/17820)) |
| 187 | + * Better error for `mypy -p package` without py.typed (Joe Gordon, PR [17908](https://github.com/python/mypy/pull/17908)) |
| 188 | + * Emit error for "raise NotImplemented" (Brian Schubert, PR [17890](https://github.com/python/mypy/pull/17890)) |
| 189 | + * Add is_lvalue attribute to AttributeContext (Brian Schubert, PR [17881](https://github.com/python/mypy/pull/17881)) |
| 190 | + |
| 191 | +### Acknowledgements |
| 192 | + |
| 193 | +Thanks to all mypy contributors who contributed to this release: |
| 194 | + |
| 195 | +- aatle |
| 196 | +- Abel Sen |
| 197 | +- Advait Dixit |
| 198 | +- ag-tafe |
| 199 | +- Alex Waygood |
| 200 | +- Ali Hamdan |
| 201 | +- Brian Schubert |
| 202 | +- Carlton Gibson |
| 203 | +- Chad Dombrova |
| 204 | +- Chelsea Durazo |
| 205 | +- chiri |
| 206 | +- Christoph Tyralla |
| 207 | +- coldwolverine |
| 208 | +- David Salvisberg |
| 209 | +- Ekin Dursun |
| 210 | +- Evgeniy Slobodkin |
| 211 | +- falsedrow |
| 212 | +- Gaurav Giri |
| 213 | +- Ihor |
| 214 | +- Ivan Levkivskyi |
| 215 | +- jairov4 |
| 216 | +- Jannick Kremer |
| 217 | +- Jelle Zijlstra |
| 218 | +- jhance |
| 219 | +- jianghuyiyuan |
| 220 | +- Joe Gordon |
| 221 | +- John Doknjas |
| 222 | +- Jukka Lehtosalo |
| 223 | +- Jukka Lehtosalo |
| 224 | +- Kanishk Pachauri |
| 225 | +- Marc Mueller |
| 226 | +- Max Chang |
| 227 | +- MechanicalConstruct |
| 228 | +- Newbyte |
| 229 | +- q0w |
| 230 | +- Ruslan Sayfutdinov |
| 231 | +- Sebastian Rittau |
| 232 | +- Shantanu |
| 233 | +- sobolevn |
| 234 | +- Stanislav Terliakov |
| 235 | +- Stephen Morton |
| 236 | +- Sukhorosov Aleksey |
| 237 | +- Séamus Ó Ceanainn |
| 238 | +- Terence Honles |
| 239 | +- Valentin Stanciu |
| 240 | +- vasiliy |
| 241 | +- Victorien |
| 242 | +- yihong |
| 243 | + |
| 244 | +I’d also like to thank my employer, Dropbox, for supporting mypy development. |
| 245 | + |
| 246 | + |
45 | 247 | ## Mypy 1.13 |
46 | 248 |
|
47 | 249 | We’ve just uploaded mypy 1.13 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). |
|
0 commit comments