Is there a way to do a flake8 check for tooltip types in the source

I am starting a new python project (python 3.5+) and I would like to use type hints in the entire codebase. Is there any way to do this with flake8or with any other tool?

+4
source share
3 answers

Take a look at mypy .

From the website:

Mypy - Python, ( "" ) . Mypy Python . Mypy Python; Python, .

mypy - , , , . , , , .

--disallow-untyped-defs , .

--check-untyped-defs , - , . ( .) , Any Any .

--disallow-untyped-calls , , .

...

+2

mypy Python. .

+1

mypy, , . , :

disallow_untyped_calls (Boolean, False) .

disallow_untyped_defs (Boolean, False) .

Or you can set these parameters as command line arguments .


FYI PyLintdoes not yet support forcing type annotations, but there is a function request . And I do not see anything related to the front flake8/ pyflakes- consider opening a function request .

+1
source

Source: https://habr.com/ru/post/1673906/


All Articles