Mypy Blog
mypy-lang.blogspot.com · Company blog · on HN since 2013
The official blog of the mypy project, announcing releases of the optional static type checker for Python.
What HN saysHN links it for mypy release news and Dropbox's PyAnnotate announcement, which commenters compare with other type annotation tools like MonkeyType.
27HN people shared it
5linked it in comments
29stories submitted
434story points
6 months agolast shared
2013people per year2026
Most-shared posts
- 1Mypy 1.62 people · 24 points · first shared 2023 · 3 comments on HN
- 2Mypy 0.900 Released2 people · 7 points · first shared 2021 · 3 comments on HN
- 3Mypy 0.700 Released: Up to 4x Faster2 people · 5 points · first shared 2019 · discussion on HN
- 4Mypy 0.530 Released2 people · 2 points · first shared 2017 · discussion on HN
- 5Mypy 0.930 released with TypeAlias and better dict typing2 people · 1 points · first shared 2021 · discussion on HN
- 6Typed Python: new Mypy release1 people · 156 points · first shared 2016 · 46 comments on HN
- 7PyAnnotate – Auto-generate type annotations for mypy1 people · 129 points · first shared 2017 · 33 comments on HN
- 8Mypy 0.3 Released – optional static type checker for Python1 people · 77 points · first shared 2016 · 19 comments on HN
- 9Mypy 1.0 Released1 people · 7 points · first shared 2023 · discussion on HN
- 10Mypy 1.7 Released1 people · 3 points · first shared 2023 · discussion on HN
- 11Mypy 0.740 Released1 people · 3 points · first shared 2019 · discussion on HN
- 12Mypy 1.5 Released1 people · 2 points · first shared 2023 · discussion on HN
- 13Mypy Switches to Python-Compatible Syntax1 people · 2 points · first shared 2013 · discussion on HN
- 14Mypy 0.520 Released1 people · 2 points · first shared 2017 · discussion on HN
- 15Mypy 0.660 Released1 people · 2 points · first shared 2019 · discussion on HN
What HN people wrote when they linked it
syastrov · 2019-03-24
Django has quite a lot of "magic" as well. There is work being done on a mypy plugin to support this magic in addition to type stubs. It is already quite usable and supports type-checking many common patterns: https://github.com/mkurnikov/django-stubs
See also mypy's recent blog post on plugins (which are also used for supporting Python 3.7's dataclasses, which are quite dynamic as well): http://mypy-lang.blogspot.com/2019/03/extending-mypy-with-plugins.html
JosephRedfern · 2017-12-21
This sounds similar to Dropbox's PyAnnotate -- Guido van Rossum writes about it here: http://mypy-lang.blogspot.co.uk/2017/11/dropbox-releases-pyannotate-au…
Would be interesting to see how MonkeyType and PyAnnotate compare.
muizelaar · 2017-12-21
I wonder how this compares to PyAnnotate: http://mypy-lang.blogspot.ca/2017/11/dropbox-releases-pyannotate-auto.…
pixelmonkey · 2015-11-25
It's cool that PyCharm added support for this -- the point of the typing module and the type hinting PEP is for IDEs to adopt it for linting purposes.
For those of you using vim, emacs, and the standard UNIX editing toolchain, the mypy linter provides command-line support. This blog post from April 2015 describes the first version of mypy that includes support for the official typing library.
http://mypy-lang.blogspot.co.uk/2015/04/mypy-02-released.html
kirbyfan64sos · 2022-04-22
> There is no way to get typing like dataclasses without writing your own mypy plugin. The syntax is simply not expressive enough to do it. This means that if you want to be productive with a library like Pydantic, you also have to add the mypy plugin to your dependencies and add it to your mypy config. Otherwise, no typing.
This would be solved by PEP 681, which originates from (and is already used in) pyright: https://peps.python.org/pep-0681/
> 3. To this day, there is still no way to express optional keys. Not "Optional" keys, but keys that can be left out of your dictionary. The closest you can get is this weird hack where you can set `total=False` in your TypedDict, which makes all keys optional.
This is solved by PEP 655, which introduces NotRequired: https://peps.python.org/pep-0655/
It's implemented in mypy 0.930: https://mypy-lang.blogspot.com/2021/12/mypy-0930-released.html
> I really wish Python learned from Typescript, but it's too late at this point
Personally, I feel like it's partly just entirely different styles: Python relies on a mix of nominal and duck types, whereas JavaScript is much more focused on structural typing. As a result, there are a lot of things like TypedDict that are absolutely essential for JS to even function but a decent bit less so in idiomatic Python code (keeping a significant amount of dicts around uses much more memory than objects, I recall a PyCon talk explicitly mentioning this too).