Pytype is a static analysis tool for Python code that performs data type inference and type checking. It is used by "thousands of projects at Google," to weed out errors. It will identify and flag places in the code where there is an execution path that can perform an operation that will fail because the types of the operands are incompatible. It also flags common mistakes, such as misspelled attribute names, calls to non-existent functions, and a long list of other possible errors. Users can also provide type annotations in comments for each function, declaring explicitly what the types of the arguments should be rather than relying on Pytype's inference engine. Pytype can also produce a list of all the data types it infers that can be used to add type annotations. Pytype can be installed via Python's `pip` package manager.
Comments