Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"detachhead.basedpyright",
"charliermarsh.ruff",
"prisma.prisma",
"kevinrose.vsc-python-indent",
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Follow these steps to set up your local development environment. For more compre
# Lint code using Ruff
poetry run tux dev lint-fix

# Type-check code using Pyright
# Type-check code using basedpyright
poetry run tux dev type-check

# Run all pre-commit checks (includes formatting, linting, etc.)
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ------------------
# 1. Smart file change detection to skip unnecessary jobs
# 2. Parallel execution for different linting categories
# 3. Comprehensive Python static analysis with Pyright
# 3. Comprehensive Python static analysis with basedpyright
# 4. Infrastructure validation (Docker, GitHub Actions, Shell)
# 5. Markdown linting for documentation quality
# 6. Efficient caching to reduce execution time
Expand Down Expand Up @@ -62,15 +62,15 @@ jobs:
# PYTHON QUALITY CHECKS - Static Analysis and Type Checking
# ============================================================================
# Purpose: Ensures Python code quality through static analysis and type checking
# Tools: Pyright type checker with Poetry dependency management
# Tools: Basedpyright type checker with Poetry dependency management
# Optimization: Only runs when Python files or dependencies change
# ============================================================================
python:
name: Python Type Checking
runs-on: ubuntu-latest
permissions:
contents: read # Required for checkout
pull-requests: write # Required for Pyright annotations
pull-requests: write # Required for basedpyright annotations
steps:
# REPOSITORY CHECKOUT
# Full history needed for accurate change detection
Expand Down Expand Up @@ -115,14 +115,10 @@ jobs:
generate-prisma: 'true'

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

# ============================================================================
# MARKDOWN DOCUMENTATION LINTING
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"EditorConfig.EditorConfig",
"ms-vscode-remote.remote-containers",
"ms-python.python",
"ms-python.vscode-pylance",
"detachhead.basedpyright",
"ms-azuretools.vscode-docker",
"charliermarsh.ruff",
"prisma.prisma",
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"source.organizeImports.ruff": "explicit"
}
},
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "strict",
"python.analysis.typeCheckingMode": "off",
"cursorpyright.analysis.typeCheckMode": "off",
"python.languageServer": "None",
"python.analysis.autoFormatStrings": true,
"python.analysis.completeFunctionParens": true,
"python.analysis.autoImportCompletions": true,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ It is designed to provide a variety of features to the server, including moderat
- Python 3.13+ alongside the `discord.py` library
- Poetry for dependency management
- Docker and Docker Compose for optional containerized environments
- Strict typing with `pyright` and type hints
- Strict typing with `basedpyright` and type hints
- Type safe ORM using `prisma`
- Linting and formatting via `ruff`
- Custom CLI via `click` and `poetry` scripts
Expand Down
55 changes: 33 additions & 22 deletions poetry.lock

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

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jinja2 = "^3.1.6"

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

[tool.pyright]
[tool.basedpyright]
defineConstant = { DEBUG = true }
enableReachabilityAnalysis = true
exclude = ["__pypackages__", "_build", "examples", ".archive", "typings/**"]
Expand All @@ -160,6 +160,7 @@ stubPath = "typings"
pythonPlatform = "Linux"
pythonVersion = "3.13"
reportImportCycles = true
reportRedeclaration = false
strictDictionaryInference = true
strictListInference = true
strictSetInference = true
Expand Down
4 changes: 2 additions & 2 deletions tux/cli/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

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

Check warning on line 34 in tux/cli/dev.py

View check run for this annotation

Codecov / codecov/patch

tux/cli/dev.py#L34

Added line #L34 was not covered by tests


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