Skip to content

Commit 567b270

Browse files
authored
Merge pull request #1001 from allthingslinux/basedpyright
build: switch to basedpyright
2 parents 8cd2837 + f75fcaa commit 567b270

File tree

9 files changed

+51
-42
lines changed

9 files changed

+51
-42
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"vscode": {
2020
"extensions": [
2121
"ms-python.python",
22-
"ms-python.vscode-pylance",
22+
"detachhead.basedpyright",
2323
"charliermarsh.ruff",
2424
"prisma.prisma",
2525
"kevinrose.vsc-python-indent",

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Follow these steps to set up your local development environment. For more compre
169169
# Lint code using Ruff
170170
poetry run tux dev lint-fix
171171
172-
# Type-check code using Pyright
172+
# Type-check code using basedpyright
173173
poetry run tux dev type-check
174174
175175
# Run all pre-commit checks (includes formatting, linting, etc.)

.github/workflows/ci.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# ------------------
1111
# 1. Smart file change detection to skip unnecessary jobs
1212
# 2. Parallel execution for different linting categories
13-
# 3. Comprehensive Python static analysis with Pyright
13+
# 3. Comprehensive Python static analysis with basedpyright
1414
# 4. Infrastructure validation (Docker, GitHub Actions, Shell)
1515
# 5. Markdown linting for documentation quality
1616
# 6. Efficient caching to reduce execution time
@@ -62,15 +62,15 @@ jobs:
6262
# PYTHON QUALITY CHECKS - Static Analysis and Type Checking
6363
# ============================================================================
6464
# Purpose: Ensures Python code quality through static analysis and type checking
65-
# Tools: Pyright type checker with Poetry dependency management
65+
# Tools: Basedpyright type checker with Poetry dependency management
6666
# Optimization: Only runs when Python files or dependencies change
6767
# ============================================================================
6868
python:
6969
name: Python Type Checking
7070
runs-on: ubuntu-latest
7171
permissions:
7272
contents: read # Required for checkout
73-
pull-requests: write # Required for Pyright annotations
73+
pull-requests: write # Required for basedpyright annotations
7474
steps:
7575
# REPOSITORY CHECKOUT
7676
# Full history needed for accurate change detection
@@ -115,14 +115,10 @@ jobs:
115115
generate-prisma: 'true'
116116

117117
# STATIC TYPE CHECKING
118-
# Pyright provides comprehensive type checking for Python
118+
# basedpyright provides comprehensive type checking for Python
119119
# Annotations appear directly in PR for developer feedback
120-
- name: Run Pyright type checker
121-
if: steps.python_changes.outputs.any_changed == 'true' || github.event_name
122-
== 'workflow_dispatch'
123-
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2
124-
with:
125-
annotate: errors
120+
- name: Run basedpyright type checker
121+
run: poetry run basedpyright
126122

127123
# ============================================================================
128124
# MARKDOWN DOCUMENTATION LINTING

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"EditorConfig.EditorConfig",
44
"ms-vscode-remote.remote-containers",
55
"ms-python.python",
6-
"ms-python.vscode-pylance",
6+
"detachhead.basedpyright",
77
"ms-azuretools.vscode-docker",
88
"charliermarsh.ruff",
99
"prisma.prisma",

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"source.organizeImports.ruff": "explicit"
1212
}
1313
},
14-
"python.languageServer": "Pylance",
15-
"python.analysis.typeCheckingMode": "strict",
14+
"python.analysis.typeCheckingMode": "off",
15+
"cursorpyright.analysis.typeCheckMode": "off",
16+
"python.languageServer": "None",
1617
"python.analysis.autoFormatStrings": true,
1718
"python.analysis.completeFunctionParens": true,
1819
"python.analysis.autoImportCompletions": true,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ It is designed to provide a variety of features to the server, including moderat
5858
- Python 3.13+ alongside the `discord.py` library
5959
- Poetry for dependency management
6060
- Docker and Docker Compose for optional containerized environments
61-
- Strict typing with `pyright` and type hints
61+
- Strict typing with `basedpyright` and type hints
6262
- Type safe ORM using `prisma`
6363
- Linting and formatting via `ruff`
6464
- Custom CLI via `click` and `poetry` scripts

poetry.lock

Lines changed: 33 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jinja2 = "^3.1.6"
5555

5656
[tool.poetry.group.dev.dependencies]
5757
pre-commit = "==4.2.0"
58-
pyright = "==1.1.403"
58+
basedpyright = "==1.29.5" # currently downgraded due to https://github.com/DetachHead/basedpyright/issues/1395
5959
ruff = "==0.12.7"
6060
poetry-types = "0.6.0"
6161
yamllint = "1.37.1"
@@ -150,7 +150,7 @@ line-ending = "lf"
150150
quote-style = "double"
151151
skip-magic-trailing-comma = false
152152

153-
[tool.pyright]
153+
[tool.basedpyright]
154154
defineConstant = { DEBUG = true }
155155
enableReachabilityAnalysis = true
156156
exclude = ["__pypackages__", "_build", "examples", ".archive", "typings/**"]
@@ -160,6 +160,7 @@ stubPath = "typings"
160160
pythonPlatform = "Linux"
161161
pythonVersion = "3.13"
162162
reportImportCycles = true
163+
reportRedeclaration = false
163164
strictDictionaryInference = true
164165
strictListInference = true
165166
strictSetInference = true

tux/cli/dev.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def format_code() -> int:
3030

3131
@command_registration_decorator(dev_group, name="type-check")
3232
def type_check() -> int:
33-
"""Check types with Pyright."""
34-
return run_command(["pyright"])
33+
"""Check types with basedpyright."""
34+
return run_command(["basedpyright"])
3535

3636

3737
@command_registration_decorator(dev_group, name="pre-commit")

0 commit comments

Comments
 (0)