Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Add basedpyright
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDrike committed Jul 16, 2024
1 parent 296b705 commit a8f3544
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ jobs:
restore-keys: "precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs-python-version}}-"

- name: Run pre-commit hooks
run: SKIP=ruff-linter,ruff-formatter pre-commit run --all-files
run: SKIP=ruff-linter,ruff-formatter,basedpyright pre-commit run --all-files

- name: Run ruff linter
run: ruff check --output-format=github --show-fixes --exit-non-zero-on-fix .

- name: Run ruff formatter
run: ruff format --diff .

- name: Run basedpyright type checker
run: basedpyright --warnings .
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ repos:
language: system
types_or: [python, pyi]
require_serial: true

- repo: local
hooks:
- id: basedpyright
name: Based Pyright
description: Run basedpyright type checker
entry: poetry run basedpyright --warnings
language: system
types: [python]
pass_filenames: false # pyright runs for the entire project, it can't run for single files
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"recommendations": ["charliermarsh.ruff"]
"recommendations": [
"charliermarsh.ruff",
"detachhead.basedpyright"
]
}
32 changes: 31 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ python = "^3.12"
[tool.poetry.group.lint.dependencies]
ruff = "^0.3.2"
pre-commit = "^3.6.2"
basedpyright = "^1.13.3"

[tool.poetry.group.test.dependencies]
pytest = "^8.1.1"
Expand Down Expand Up @@ -125,6 +126,37 @@ max-statements = 75
[tool.ruff.format]
line-ending = "lf"

[tool.basedpyright]
pythonPlatform = "All"
pythonVersion = "3.12"
typeCheckingMode = "all"

# Diagnostic behavior settings
strictListInference = false
strictDictionaryInference = false
strictSetInference = false
analyzeUnannotatedFunctions = true
strictParameterNoneValue = true
enableTypeIgnoreComments = true
deprecateTypingAliases = true
enableExperimentalFeatures = false
disableBytesTypePromotions = true

# Diagnostic rules
reportAny = false
reportImplicitStringConcatenation = false
reportUnreachable = "information"
reportMissingTypeStubs = "information"
reportUninitializedInstanceVariable = false # until https://github.com/DetachHead/basedpyright/issues/491
reportMissingParameterType = false # ruff's flake8-annotations (ANN) already covers this + gives us more control

# Unknown type reporting rules (too strict for most code-bases)
reportUnknownArgumentType = false
reportUnknownVariableType = false
reportUnknownMemberType = false
reportUnknownParameterType = false
reportUnknownLambdaType = false

[tool.pytest.ini_options]
minversion = "6.0"
asyncio_mode = "auto"
Expand Down

0 comments on commit a8f3544

Please sign in to comment.