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?
flake8
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 , , ....
--disallow-untyped-defs , .
--disallow-untyped-defs
--check-untyped-defs , - , . ( .) , Any Any .
--check-untyped-defs
--disallow-untyped-calls , , .
--disallow-untyped-calls
...
mypy Python. .
mypy, , . , :
mypy
disallow_untyped_calls (Boolean, False) .disallow_untyped_defs (Boolean, False) .
disallow_untyped_calls (Boolean, False) .
disallow_untyped_calls
disallow_untyped_defs (Boolean, False) .
disallow_untyped_defs
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 .
PyLint
pyflakes
Source: https://habr.com/ru/post/1673906/More articles:Is there an elegant solution to choose between callable and non-callable type in a Variadic template in C ++ 14 - c ++Left Anti joins Spark? - scalaFailed to import web component materials using Webpack 2 - sassThe best way to avoid merging a branch into another - gitWhat is a "double point" [eg. 5..toFixed ()] I see in minified js? - javascriptThe right way to dynamically create qml windows is qtHow to display a column based on a condition that matches true for the corresponding column in data.frame in R - rwhy do we convert to a projet connection in msbi - ssisInteractive build in Pyugarm debug console via matplotlib - pythonHow to access your contact list in an interactive native application - react-nativeAll Articles