Smart code inspections for Python type annotations — simplify, modernize, and validate your type hints with one-click quick fixes.
Union & Optional Simplification
Union[int, None] → Optional[int]
Union[X, object] → object
Union[X, Any] → Any
Union[dict] → dict
Optional[Optional[X]] → Optional[X]
Union[int, int, str] → Union[int, str]
Union[int, bool] → int # bool is subtype of int
Union[Union[A, B], C] → Union[A, B, C]Modern Pipe Syntax (Python 3.10+)
X | object → object
X | Any → Any
(X | Y) | Z → X | Y | Z
(X) | Y → X | YSyntax Conversion (disabled by default)
# Modernization (Python 3.10+)
Union[X, Y] → X | Y
Optional[X] → X | None
# Backward Compatibility (Python < 3.10)
X | Y → Union[X, Y]
X | None → Optional[X]
# PEP 585 (Python 3.9+)
List[int] → list[int]
Dict[str, int] → dict[str, int]
# PEP 695 (Python 3.12+)
MyType: TypeAlias = int → type MyType = intAdvanced Inspections (disabled by default)
- Missing
Optionalfor parameters withNonedefault - Simplify
Callable[..., Any]→Callable - Redundant
Generic[T]in class definitions - Unbound TypeVar (used only once)
- Protocol methods without type annotations
- Open Settings/Preferences → Plugins → Marketplace
- Search for "Python Annotations"
- Click Install
Or install from JetBrains Marketplace
All JetBrains IDEs with Python support:
- PyCharm (Community & Professional)
- IntelliJ IDEA with Python plugin
- Other JetBrains IDEs with Python plugin
Requires: IDE version 2025.2+
All inspections can be configured in Settings → Editor → Inspections → Python Annotations
- Enable/disable individual inspections
- Change severity levels (Error, Warning, Weak Warning)
- Suppress for specific files or scopes
Contributions are welcome! See ROADMAP.md for planned features.