Skip to content

caterinaurban/Typpete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • Build Z3 SMT solver. Follow the steps found here.
  • In the root folder (the one which contains the package and setup.py), run pip install . or python3 setup.py install. Note that installation via pip is recommended since packages installed with setup.py are not uninstallable (They can only be uninstalled by manually deleting their files)

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

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages