caterinaurban / Typpete

35 stars 6 forks source link
python smt type-inference

Typpete

SMT-based Static Type Inference for Python 3.x

Installation

Typpete has been tested with Python 3.5 and 3.6; Python 3.7 is currently not supported. To install, follow these steps:

Usage

You can run the inference with the following command

$ typpete <file_name> [flags]typpete.png

Where flags is a space separated list of options for configuring the type inference. Each flag must have the following syntax: --flag_name=flag_value. For example, the following is a valid configuration flag: --allow_attributes_outside_init=True

The currently supported flags are the following:

Flag Description Possible values
ignore_fully_annotated_function Whether to ignore the body of fully annotated functions and just take the provided types for args/return True, False*
enforce_same_type_in_branches Whether to allow different branches to use different types of same variable. True, False*
allow_attributes_outside_init Whether to allow to define instance attribute outside __init__ True*, False
none_subtype_of_all Whether to make None a subtype of all types. True*, False

* Default flag value

Example:

$ typpete python_file.py --ignore_fully_annotated_function=True