python/mypy
View on GitHub ↗ ★ 20,715 Python
Optional static typing for Python
96 mentions on Hacker News by 81 people: 8 stories, 88 comments · first 2013-07-08 · latest 2026-03-17
20082026
-
…don't work well with Prototypes; mypy isn't able to detect the as supporting the Protocol (see: https://github.com/python/mypy/issues/5481 ). But having an automatically generated DTO could work too.
comment by globular-toast · 2026-03-17 · in Show HN: Oxyde – Pydantic-native async ORM with a Rust core -
…mypyc/mypyc: Compile type annotated Python to fast C extensions https://github.com/mypyc/mypyc src: https://github.com/python/mypy/tree/master/mypyc .. docs: https://mypyc.readthedocs.io/en/latest/ : mypyc docs > Using type annotations >…
comment by westurner · 2026-01-09 · in Why AI is pushing developers toward typed languages -
…- https://github.com/python/typing/issues/242 - "Final names and attributes" https://github.com/python/mypy/pull/5522 This is where `typing.Final` comes from. - "[Python-ideas] "Immutable Builder" Pattern and Operator" https://mail.pyt
comment by westurner · 2025-12-11 · in A “frozen” dictionary for Python -
…two of the more complex type checkers make opposite decisions - MyPy uses visitors extensively - https://github.com/python/mypy/tree/master/mypy - TypeScript mostly uses switch/case functions - https://github.com/microsoft/TypeScript/blob/m…
comment by chubot · 2025-09-07 · in Baby's first type checker -
…are in active development stage in the current time of August 2025 when this was written. mypy - https://github.com/python/mypy Pyright - https://github.com/microsoft/pyright Pyrefly - https://github.com/facebook/pyrefly ty -…
comment by froh · 2025-08-20 · in An Update on Pytype -
It's literally stated in the PEP: https://peps.python.org/pep-0681/ Also: https://github.com/python/mypy/blob/501a07b45af8e44eda665e53... Also did you know mypy ignores typing of class decorators? You simply can't return a different type…
comment by bvrmn · 2025-05-09 · in Ty: A fast Python type checker and language server -
…which accepts a list of Animals, and that function could append a Dog without causing a type error. https://github.com/python/mypy/issues/4976 is an interesting discussion on this in Python: should a TypedDict be allowed where a dict…
comment by btown · 2025-03-29 · in You Need Subtyping -
…[1]. [0] https://docs.python.org/3/library/typing.html (from Python 3.5 - released Sep 2015) [1] https://github.com/python/mypy (v0.1 released Sep 2009)
comment by meander_water · 2025-02-09 · in Go Data Structures: Interfaces (2009) -
…> Duplicate of #5613, still low priority, better use dataclasses, as suggested above. 1. https://github.com/python/mypy/issues/5944#issuecomment-4412...
comment by pushfoo · 2025-01-31 · in "We're building a new static type checker for Python" -
…support PEP 695 until its 1.11 release in July. [0] -- https://github.com/microsoft/pyright [1] -- https://github.com/python/mypy
comment by wdroz · 2024-10-07 · in Python 3.13.0 Is Released -
…syntax, even though it's Pythonic enough to learn it in a rather short period of time, but still... https://github.com/python/mypy
comment by stefanos82 · 2024-09-06 · in Achieving high Python performance with code generation (2022) -
https://github.com/python/mypy > Python itself doesn't do that The type syntax is python. MyPy is part of Python. It's maintained by the python foundation. Mypy is not part of CPython because modularity is good, the same way that ANSI C…
comment by kortex · 2024-07-13 · in Free-threaded CPython is ready to experiment with -
It's part of the Mypy project: https://github.com/python/mypy/tree/master/mypyc
comment by heavyset_go · 2024-06-16 · in Nvidia Warp: A Python framework for high performance GPU simulation and graphics -
…cause problems. For example, the Mypy type checker refuses to acknowledge that this is possible: https://github.com/python/mypy/issues/1020
comment by nickdrozd · 2024-04-03 · in Every Dunder Method in Python -
It's got type annotations and mypy has a discussion about it here as well: https://github.com/python/mypy/issues/1282
comment by gigatexal · 2024-02-14 · in A bird's eye view of Polars -
…to achieve better results, but then it's not quite Python anymore. [0] https://nuitka.net/ [1] https://github.com/python/mypy/tree/master/mypyc
comment by ptx · 2024-01-09 · in Python 3.13 Gets a JIT -
…type-checks but gives a TypeError at runtime. Oops. (cause discussed at length in https://github.com/python/mypy/issues/9015 but without action for 3 years) One solution is apparently to use `datetype` for type annotations (while continuing
comment by jepler · 2023-11-19 · in datetime.utcnow() is now deprecated -
…bad programs. * Overall, I'm personally very optimistic about the future of types in Python! [1] https://github.com/python/mypy/issues/1773 [2] https://discuss.python.org/t/extend-type-hints-to-cover-exce...
comment by gnulinux · 2023-10-18 · in What's New in Python 3.12 -
You probably already know but you can add type hints and then check for consistency with https://github.com/python/mypy in python. Modern Python with things like https://learnpython.com/blog/python-match-case-statement/ + mypy + Ruff for…
comment by kingkongjaffa · 2023-10-05 · in Ask HN: Why are all of the best back end web frameworks dynamically typed? -
…where it's limits are, but particularly with the haskell comparison, it does not support GADTs ( https://github.com/python/mypy/issues/8252 ). Also, I know it doesn't support Rust's affine type system (ownership/borrows). Nah when it comes…
comment by formulathree · 2023-07-13 · in Ask HN: I have 10 yrs of Exp. Failed 4 takehome projects. What am I doing wrong? -
…where it's limits are, but particularly with the haskell comparison, it does not support GADTs ( https://github.com/python/mypy/issues/8252 ). Also, I know it doesn't support Rust's affine type system (ownership/borrows). It's true that…
comment by hardwaresofton · 2023-07-13 · in Ask HN: I have 10 yrs of Exp. Failed 4 takehome projects. What am I doing wrong? -
…happened to trigger it. There are over 1.4k open bug tickets it's such a broken piece of software: https://github.com/python/mypy/issues?q=is%3Aissue+is%3Aopen... The involvement of Guido in mypy is such a tragedy.
comment by lyu07282 · 2023-05-21 · in Writing Python like it's Rust -
…commit [3], possibly moved from the VSCode extension). [0] https://peps.python.org/pep-3107/ [1] https://github.com/python/mypy/commit/6f0826a9c169c4f05bb893... [2] https://peps.python.org/pep-0484/ [3]…
comment by Kwpolska · 2023-04-16 · in The different uses of Python type hints -
Looks like they added support for unboxed floats yesterday (not sure about integers): https://github.com/python/mypy/commit/d05974b9b099ec755fd1c6...
comment by ptx · 2023-03-15 · in Python-based compiler achieves orders-of-magnitude speedups -
…missing ones should be easy. For the missing ones Any is a good choice. https://pyre-check.org and https://github.com/python/mypy are popular.
comment by zitterbewegung · 2023-01-17 · in Ruby 3.2’s YJIT is Production-Ready -
The last time I actively looked into it (granted, some months ago), it was somewhat hindered by https://github.com/python/mypy/issues/9309 causing it to re-evaluate sources quite a lot during editing even with mypyd. I just had a quick…
comment by shabble · 2023-01-03 · in Pyright: Static Type Checker for Python -
…like Python that don't provide any static type safety https://docs.python.org/3/library/typing.html https://github.com/python/mypy > let alone null safety https://docs.python.org/3/library/typing.html#typing.Optiona...
comment by masklinn · 2022-12-08 · in The road to Dart 3: A fully sound, null safe language -
…needed good type information, which is why I used mypy[0] as the AST parser/type checker. [0]: https://github.com/python/mypy
comment by dosisod · 2022-09-28 · in Show HN: Refurb – A tool for refurbishing and modernizing Python codebases -
Mypy is basically that. https://github.com/python/mypy
comment by nielsbot · 2022-08-14 · in Erg: a statically typed language that is Python compatible -
…a real shame that the Python ecosystem doesn't have anything nearly as robust as TypeScript. [0] https://github.com/python/mypy/issues?q=is%3Aopen+is%3Aissue...
comment by svetb · 2022-08-13 · in Erg: a statically typed language that is Python compatible -
…it allows you to turn it off when it's not worth it. [1]: https://github.com/microsoft/pyright [2]: https://github.com/python/mypy [3]: https://github.com/google/pytype [4]: https://github.com/facebook/pyre-check [5]:…
comment by gilch · 2022-08-13 · in Erg: a statically typed language that is Python compatible -
…python3 type hints Mypyc ships with mypy and does this. Mypy itself and Black are compiled with it. https://github.com/python/mypy/tree/master/mypyc
comment by FreakLegion · 2022-07-29 · in Omyyyy/pycom: A Python compiler, down to native code, using C++ -
…the way you would think for dataclasses or at all for dicts/TypedDicts. See this for dataclasses: https://github.com/python/mypy/issues/5374#issuecomment-8841... .
comment by oivey · 2022-06-26 · in Don't let dicts spoil your code (2020) -
…where either the user or the mypy devs are saying "use type: ignore as a workaround for now": https://github.com/python/mypy/issues?q=is%3Aopen+label%3Afa...
comment by zzzeek · 2022-04-29 · in You Should Compile Your Python and Here’s Why -
It reminds me of this 5 year old bug in mypy: "int is not a Number?" [1]. [1]: https://github.com/python/mypy/issues/3186
comment by ciupicri · 2022-04-21 · in Python’s “type hints” are a bit of a disappointment to me -
…are still a lot of areas we can improve quite a lot with far less effort than a full rewrite. 1: https://github.com/python/mypy/issues/2756#issuecomment-8772...
comment by gjulianm · 2021-10-07 · in Faster Python with Guido van Rossum -
That's a PEP for Python 3.10, which isn't even released yet. And Mypy only supports it since May: https://github.com/python/mypy/issues/5206#issuecomment-8441...
comment by iso8859-1 · 2021-07-22 · in TypeScript 4.4 Beta -
I'm well aware. Have you seen this drama about it? https://github.com/python/mypy/issues/5205#issuecomment-4102...
comment by mikepurvis · 2021-04-20 · in Python Software Foundation Is Hiring a Python Packaging Project Manager -
See also mypy and pyproject.toml support ( https://github.com/python/mypy/issues/5205 ), although there's currently a PR in progress that'll hopefully put that to rest.
comment by guitarbill · 2021-04-16 · in PEP 563, PEP 649 and the future of pydantic and FastAPI -
mypy is actually compiled via mypyc, which should be a few times faster than interpreted Python https://github.com/python/mypy/tree/master/mypyc
comment by watermelon0 · 2021-03-21 · in Adoption of Mypy for Python type checking: 45% already use it, 40% don't plan to -
…up mypy). One example is JSON-like `dict`s, since mypy doesn't support recursive types yet[1]. [1] https://github.com/python/mypy/issues/731
comment by l0b0 · 2021-03-19 · in I Want a New Duck (2020) -
It won't be ready for production use for a while, but https://github.com/python/mypy/tree/master/mypyc is being worked on.
comment by viraptor · 2021-02-22 · in Go is not an easy language -
Yes: https://github.com/python/mypy/tree/master/mypyc
comment by O5vYtytb · 2021-01-27 · in Python's Type Checking Renaissance -
…that we'll see a raise of crystal ( https://crystal-lang.org/ ) and a serious progress in mypyc ( https://github.com/python/mypy/tree/master/mypyc ) which provide a nice middle ground.
comment by viraptor · 2021-01-13 · in Some Unlikely 2021 Predictions -
Mypy doesn't like function attributes, https://github.com/python/mypy/issues/2087
comment by wocram · 2020-12-21 · in Python at Scale: Strict Modules -
…to always use isinstance checks. Its actually discouraged to return union types by the mypy team: https://github.com/python/mypy/issues/1693
comment by londt8 · 2020-12-15 · in Exhaustiveness Checking with Mypy -
…black [1] code formatter. I think it would be interesting to see how EPython compares to mypyc. [0] https://github.com/python/mypy/tree/master/mypyc [1] https://github.com/psf/black/pull/1009
comment by Rotareti · 2020-10-22 · in Attempts to make Python fast -
The list should probably also include mypyc: https://github.com/python/mypy/tree/master/mypyc
comment by willseth · 2020-10-21 · in Attempts to make Python fast -
You're basically talking about mypyc: https://github.com/python/mypy/tree/master/mypyc
comment by oefrha · 2020-10-20 · in Implementation plan for speeding up CPython