mypy Static Type Checker

mypy Static Type Checker

github.com

5

About this website

mypy is an optional static type checker for Python, created by Jukka Lehtosalo at Aalto University. With over 19,000 stars as of 2026, mypy is the reference implementation of Python's type hinting system (PEP 484) and the de facto standard for static type analysis in Python. mypy combines the expressiveness of Python's dynamic typing with the safety of static typing, enabling developers to incrementally add type annotations and catch type errors before runtime. Key features include: gradual typing (allowing annotations to be added incrementally, with untyped code treated as Any type, enabling adoption in existing codebases without all-at-once migration), PEP 484 type hints (supporting Optional, Union, List, Dict, Tuple, Callable, TypeVar, Generic, Literal, TypedDict, Protocol, and Final), type inference (automatically inferring types for expressions without explicit annotations), function annotation checking (verifying arguments and return values match declared types), class and attribute type checking (checking method signatures, attribute assignments, and inheritance for type safety), generics (supporting parametric generics with TypeVar bounds, variance, and constraints), protocol types (structural subtyping via Protocol, enabling duck typing with static verification), strict mode (enabling comprehensive checking with strict optional, disallow untyped defs, and many strict flags), plugin system (extending type checking for dynamic library patterns via plugins for dataclasses, attrs, SQLAlchemy, Pydantic, NumPy, and others), stub files (.pyi files for providing type information for libraries without annotations), incremental checking (caching type checking results for faster subsequent runs), and CI/CD integration.

Tags & Categories

Statistics

5
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!