diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml new file mode 100644 index 00000000..eb2289e0 --- /dev/null +++ b/.github/workflows/type-check.yml @@ -0,0 +1,38 @@ +name: type-check + +on: + push: + branches: + - staging + - main + pull_request: + branches: + - staging + - main + +jobs: + typecheck: + runs-on: ubuntu-22.04 + + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + cache-dependency-glob: uv.lock + + - name: Install Python + run: uv python install + + - name: Sync dependencies + run: uv sync --locked --all-extras --dev + + - name: Run type checker + run: uv run poe check diff --git a/pyproject.toml b/pyproject.toml index 509c88a5..b5717689 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ dependencies = [] [dependency-groups] dev = [ + "basedpyright>=1.29.4", "poethepoet>=0.35.0", "pytest>=8.4.0", "ruff>=0.11.13", @@ -18,6 +19,24 @@ members = [ "master", "worker", "shared", ] +[tool.basedpyright] +typeCheckingMode = "strict" +failOnWarnings = true + +reportAny = "error" +reportUnknownVariableType = "error" +reportUnknownParameterType = "error" +reportMissingParameterType = "error" +reportMissingTypeStubs = "error" +reportInvalidCast = "error" +reportUnnecessaryCast = "error" +reportUnnecessaryTypeIgnoreComment = "error" + +include = ["master", "worker", "shared", "engines/*"] +pythonVersion = "3.13" +pythonPlatform = "Darwin" + [tool.poe.tasks] fmt = { shell = "ruff format .", help = "Format the code" } -test = { shell = "pytest master worker shared", help = "Run the tests" } \ No newline at end of file +test = { shell = "pytest master worker shared", help = "Run the tests" } +check = { shell = "basedpyright --project .", help = "Run type checker" } \ No newline at end of file