Friday 20 October 2017

Mypy 0.540 Released

We’ve just uploaded mypy 0.540 to the Python Package Index (PyPI). This release includes new features, bug fixes and library stub (typeshed) updates. You can install it as follows:

    python3 -m pip install -U mypy

You can read the documentation for this release on ReadTheDocs.

Switch to More Rapid Releases

Going forward, we are going to release a new mypy version roughly every 2-4 weeks. The motivation is to make the release process lighter-weight and more predictable, and to reduce the need for bug fix releases — the next normal release will be a short time away, so we’d only need bug fix releases for critical bugs. As a bonus, users will get new features and bug fixes sooner, and contributors will have their PRs released faster!

New Features

  • Allow assignments to multiple targets from union types (Ivan Levkivskyi, PR 4067)
  • Allow definitions of subscripted type aliases such as Item = Tuple[int, str] within functions (Ivan Levkivskyi, PR 4000)
  • Narrow type of optional left operand of in operator if the collection items aren’t optional (Ivan Levkivskyi, PR 4072)
  • Generate an error if <unknown> type would be inferred for a variable (PR 4112)

Notable Bugs Fixed

  • Fix errors not being reported for some modules with incremental mode by deleting cache file for a module if errors are found (Ivan Levkivskyi, PR 4045)
  • Fix incremental mode crash related to Type[...] types (Ivan Levkivskyi, PR 4038)
  • Fix crash related to tuple types (Ivan Levkivskyi, PR 4051)
  • Fix incorrect errors about __getattr__ methods (Ivan Levkivskyi, PR 4073)
  • Fixes to non-method attributes with callable types (Elazar Gershuni, PR 4016)
  • Fix function overloading based on Type[...] types (Ivan Levkivskyi, PR 4037)
  • Fix processing invalid overloaded function definitions (Elazar Gershuni, PR 4064)
  • Fix handling of disallow_any/disallow_untyped_defs combination in mypy config file (Jelle Zijlstra, PR 4076)

Acknowledgments

First of all, we’d like to thank our employer, Dropbox, for funding the mypy core team.

Thanks to all mypy contributors who contributed to this release:

  • Carl Meyer
  • Edward Betts
  • Elazar Gershuni
  • Ethan Smith
  • Ivan Levkivskyi
  • Jelle Zijlstra

Additional thanks to all contributors to typeshed:

  • Ashwini Chaudhary
  • FichteFoll
  • Gábor Bernát
  • Jelle Zijlstra
  • Lloyd
  • Max Rozentsveyg
  • Michael Lee
  • Naman Bharadwaj
  • Semyon Proshev
  • Suren Nihalani
  • Travis Parker
  • hashstat
  • rymdhund