diff --git a/.gitignore b/.gitignore index 6e197e75c6..59d7832f99 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ target/ **/*.pyc lcov.info .idea -.vscode .envrc +.vscode/* +!.vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..540d2904ec --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + // Python + "python.formatting.provider": "black", + "python.analysis.typeCheckingMode": "strict" +} diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000000..ba52c21726 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.9 +mypy_path = tools diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..2d341f3d8c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[tool.black] +line-length = 100 + +[tool.pyright] +include = ["tools"] +exclude = ["target"] +ignore = ["infra", "tools/windows", "tools/contrib"] +pythonVersion = "3.9" +pythonPlatform = "Linux" +typeCheckingMode = "strict" + diff --git a/tools/health-check b/tools/health-check index 9c30ec745b..1fe0d1826c 100755 --- a/tools/health-check +++ b/tools/health-check @@ -18,12 +18,12 @@ def check_python_tests(context: CheckContext): def check_python_types(context: CheckContext): "Run mypy on all python files to type-check." - mypy = cmd("mypy --pretty --color-output").env("MYPY_FORCE_COLOR", "1").env("MYPYPATH", "tools") + mypy = cmd("mypy --pretty --color-output").env("MYPY_FORCE_COLOR", "1") parallel(*mypy.foreach(context.all_files)).fg() def check_python_format(context: CheckContext): - black = cmd("black", "--line-length 100", "--check" if not context.fix else "") + black = cmd("black", "--check" if not context.fix else "") parallel(*black.foreach(context.modified_files)).fg()