Skip to content

Commit 0c8fb9c

Browse files
C-LoftuspokeyAndreasArvidsson
authored
Pyright Configuration for CI Pipeline (#2267)
Discussed with Pokey at Cursorless meetup last weekend about Pyright CI. Posting this here as a discussion to evaluate if Pyright is useful for Cursorless in its CI pipeline. ### Downside for Pyright integration - Since we can't install Talon in CI, we essentially have to ignore all Talon typing and imports unless we import typing stubs or something analogous ``` error: Import "talon" could not be resolved (reportMissingImports) ``` - Talon scripting with Python has development patterns that deviate from the norm so we have to ignore some errors similar to the following ``` error: Type of parameter "key" must be a supertype of its class "Actions" (reportGeneralTypeIssues) ``` - Not entirely sure why you can't get around the "type of parameter X must be a supertype" but since it throws an error you essentially have to disable all `reportGeneralTypeIssues` to get rid of it. - submitted issue to microsoft/pyright#7513 ### Current Config ```toml [tool.pyright] # Talon classes don't use self so ignore the associated errors reportSelfClsParameterName = false # Talon can't be installed in CI so ignore source errors reportMissingModuleSource = false reportMissingImports = false ``` May or may not want the following ``` # Ignore the type of parameter X must be a supertype of its class # reportGeneralTypeIssues = false ``` --------- Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com> Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
1 parent 006ea15 commit 0c8fb9c

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Setup python
26-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2727
with:
28-
python-version: 3.x
28+
python-version-file: "pyproject.toml"
2929

3030
- name: Install pnpm
3131
uses: pnpm/action-setup@v4
@@ -51,3 +51,8 @@ jobs:
5151
- name: Auto-fix pre-commit issues
5252
uses: pre-commit-ci/lite-action@v1.0.2
5353
if: always()
54+
55+
- name: Pyright
56+
uses: jakebailey/pyright-action@v3
57+
with:
58+
pylance-version: latest-release

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[project]
2+
name = "cursorless"
3+
version = "0.1.0"
4+
requires-python = "==3.13.*"
5+
16
[tool.ruff]
27
target-version = "py313"
38
extend-exclude = ["vendor", "data/playground/**/*.py"]
@@ -7,6 +12,7 @@ select = ["E", "F", "C4", "I001", "UP", "SIM", "FLY"]
712
ignore = ["E501", "SIM105", "UP007", "UP035", "UP045"]
813

914
[tool.pyright]
15+
pythonVersion = "3.13"
1016
reportSelfClsParameterName = false
1117
reportMissingModuleSource = false
1218
reportMissingImports = false

0 commit comments

Comments
 (0)