JetBrains IDE Plugin
Python Annotations
Smart Code Inspections for Python Type Annotations Simplify, modernize, and validate your Python type hints with 21 intelligent inspections and one-click quick fixes...
50.5KDownloads
4.4Rating
FreePricing
About
Smart Code Inspections for Python Type Annotations
Simplify, modernize, and validate your Python type hints with 21 intelligent inspections and one-click quick fixes.
Union & Optional Simplification
Union[int, None]→Optional[int]Union[X, object]→objectUnion[X, Any]→AnyUnion[dict]→dictOptional[Optional[X]]→Optional[X]Union[int, int, str]→Union[int, str](remove duplicates)Union[int, bool]→int(bool is subtype of int)Union[Union[A, B], C]→Union[A, B, C](flatten nested)- Detect invalid
Union[]
Modern Pipe Syntax (Python 3.10+)
X | object→objectX | Any→Any(X | Y) | Z→X | Y | Z(X) | Y→X | Y
Syntax Conversion (disabled by default)
- Modernization:
Union[X, Y]→X | Y,Optional[X]→X | None - Backward compatibility:
X | Y→Union[X, Y] - PEP 585:
List[int]→list[int] - PEP 695:
TypeAlias→typestatement
Advanced 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
User Reviews
Resolved
Please update plugin to 2021.1
Ready to try Python Annotations?
Install from JetBrains Marketplace and boost your productivity.