From da015b538c63bc6feecc33f827119e85a90cca89 Mon Sep 17 00:00:00 2001 From: Eitan Turok Date: Thu, 1 Aug 2024 06:00:54 +0000 Subject: [PATCH] pyright init --- .pre-commit-config.yaml | 28 +++++++++++++++++++--------- pyproject.toml | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59fd0ba..e08799c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,16 @@ default_language_version: python: python3 repos: +- repo: local + hooks: + - id: pyright + name: pyright + entry: pyright + language: node + types: [python] + pass_filenames: false + args: [--warnings] + additional_dependencies: ["pyright@1.1.256"] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.2.2 hooks: @@ -21,15 +31,15 @@ repos: types: [python] additional_dependencies: - toml -- repo: https://github.com/pycqa/isort - hooks: - - id: isort - rev: 5.12.0 - repo: https://github.com/hadialqattan/pycln rev: v2.1.2 hooks: - id: pycln args: [. --all] +- repo: https://github.com/pycqa/isort + hooks: + - id: isort + rev: 5.12.0 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: @@ -71,6 +81,11 @@ repos: - "#" - --allow-past-years types: [python] +- repo: https://github.com/PyCQA/docformatter + rev: v1.5.0 + hooks: + - id: docformatter + args: [--in-place, --wrap-summaries=120, --wrap-descriptions=120] - repo: https://github.com/PyCQA/pydocstyle rev: 6.1.1 hooks: @@ -82,11 +97,6 @@ repos: exclude: (.ci|.github) additional_dependencies: - toml -- repo: https://github.com/PyCQA/docformatter - rev: v1.5.0 - hooks: - - id: docformatter - args: [--in-place, --wrap-summaries=120, --wrap-descriptions=120] - repo: https://github.com/adrienverge/yamllint.git rev: v1.28.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 13217d1..c72dbdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -489,3 +489,41 @@ ignore_patterns = [ convention="google" add_ignore="D100,D101,D102,D103,D104,D105,D107,D400,D401,D415" add_select="D404" + + +# Pyright +[tool.pyright] +exclude = ['env-**', 'venv*', '.venv', 'tests/*', '**benchmark'] +stubPath = "" # suppress useless 'stubPath is not a valid directory' errors + +reportUnnecessaryIsInstance = "none" # it is ok to do this for clarity or safety +reportMissingTypeStubs = "none" +reportIncompatibleMethodOverride = "none" +reportIncompatibleVariableOverride = "error" +reportUnusedImport = "error" +reportUnusedClass = "warning" +reportUnusedFunction = "warning" +reportUnusedVariable = "error" +reportDuplicateImport = "error" +reportWildcardImportFromLibrary = "error" +reportUntypedFunctionDecorator = "warning" +reportPrivateImportUsage = "none" +reportUndefinedVariable = "error" +strictParameterNoneValue = true +reportPropertyTypeMismatch = "error" +reportUntypedNamedTuple = "error" +reportUnnecessaryCast = "error" +reportInvalidTypeVarUse = "error" +reportOverlappingOverload = "error" +reportUninitializedInstanceVariable = "error" +reportInvalidStringEscapeSequence = "error" +reportMissingParameterType = "error" +reportCallInDefaultInitializer = "error" +reportUnnecessaryComparison = "error" +reportSelfClsParameterName = "error" +reportImplicitStringConcatenation = "warning" # TODO: make this an error +reportInvalidStubStatement = "error" +reportIncompleteStub = "error" +reportUnsupportedDunderAll = "error" +reportUnusedCoroutine = "error" +reportMissingImports = "none"