Skip to content

Commit 32e0647

Browse files
authored
Add "version: PATH" to pull pyright from $PATH (#107)
1 parent a9434fd commit 32e0647

11 files changed

Lines changed: 1038 additions & 102 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,11 @@ jobs:
8181
- uses: ./
8282
with:
8383
working-directory: ./smoke-test
84+
85+
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
86+
- run: pip install pyright
87+
88+
- uses: ./
89+
with:
90+
working-directory: ./smoke-test
91+
version: PATH

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ GitHub action for [pyright](https://github.com/microsoft/pyright). Featuring:
2222
inputs:
2323
# Options for pyright-action
2424
version:
25-
description: 'Version of pyright to run. If neither version nor pylance-version are specified, the latest version will be used.'
25+
description: 'Version of pyright to run, or "PATH" to use pyright from $PATH. If neither version nor pylance-version are specified, the latest version will be used.'
2626
required: false
2727
pylance-version:
2828
description: 'Version of pylance whose pyright version should be run. Can be latest-release, latest-prerelease, or a specific pylance version. Ignored if version option is specified.'
@@ -143,7 +143,31 @@ poetry's python binary is on `$PATH`:
143143
- uses: jakebailey/pyright-action@v2
144144
```
145145

146-
## Keeping Pyright and Pylance in sync
146+
## Providing a pyright version sourced from preexisting dependencies
147+
148+
The `version` input only accepts "latest" or a specific version number. However,
149+
there are many ways to use specify a version of `pyright` derived from other
150+
tools.
151+
152+
### Using pyright from `$PATH`
153+
154+
If you have `pyright` installed in your environment, e.g. via the `pyright` PyPI
155+
package, specify `version: PATH` to use the version that's on `$PATH`.
156+
157+
```yml
158+
- run: |
159+
python -m venv .venv
160+
source .venv/bin/activate
161+
pip install -r dev-requirements.txt # includes pyright
162+
163+
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
164+
165+
- uses: jakebailey/pyright-action@v2
166+
with:
167+
version: PATH
168+
```
169+
170+
### Keeping Pyright and Pylance in sync
147171

148172
If you use Pylance as your language server, you'll likely want pyright-action to
149173
use the same version of `pyright` that Pylance does. The `pylance-version`

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ branding:
88
inputs:
99
# Options for pyright-action
1010
version:
11-
description: 'Version of pyright to run. If neither version nor pylance-version are specified, the latest version will be used.'
11+
description: 'Version of pyright to run, or "PATH" to use pyright from $PATH. If neither version nor pylance-version are specified, the latest version will be used.'
1212
required: false
1313
pylance-version:
1414
description: 'Version of pylance whose pyright version should be run. Can be latest-release, latest-prerelease, or a specific pylance version. Ignored if version option is specified.'

0 commit comments

Comments
 (0)