/typy

Simple wrapper of Mypy: one liner type checking & execute Python code

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Typy: simple wrapper of Mypy

"Typy" is very simple wrapper of "Mypy", which is an optional static type checker for Python.

Requirements

You need Python 3.5 or later to run typy(mypy require this).

Mypy install

In MacOS, Mypy can be installed using pip:

$ pip install mypy

For other environments, packages are available at http://www.python.org/getit/.

Quick start

Typy install

  • git clone

Recommendation: you should install typy to a directry your original alias files is in.

$ git clone git@github.com:python/typy.git

Set up command alies

  • Give excecute permission to typy
$ cd typy
$ chmod u+x typy
  • Set up command alias

Add following line to ~/.bashrc or ~/.bash_profile:

alias typy="full/path/to/typy"

Reloading shell, you can use typy.

Quick Test

This repository contains quick test for typy.

Pass type checking

$ cd typy
$ typy test_success.py

output

------------ type checking -------------
Success: no issues found in 2 source files

 -------------- run script --------------
Pass Type Checking!!

Fail type checking

$ typy test_failed.py

output

------------ type checking -------------
test_failed.py:2: error: Incompatible return value type (got "int", expected "str")
Found 1 error in 1 file (checked 2 source files)