-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Alternative fix for pyright CI issues #10121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,15 +125,23 @@ jobs: | |
python-version: "3.10" | ||
cache: pip | ||
cache-dependency-path: requirements-tests.txt | ||
- name: Install external dependencies for 3rd-party stubs | ||
- name: Install typeshed test-suite requirements | ||
# Install these so we can run `get_external_stub_requirements.py` | ||
run: pip install -r requirements-tests.txt | ||
- name: Create an isolated venv for testing | ||
run: python -m venv .venv | ||
- name: Install 3rd-party stub dependencies | ||
run: | | ||
pip install -r requirements-tests.txt | ||
DEPENDENCIES=$(python tests/get_external_stub_requirements.py) | ||
if [ -n "$DEPENDENCIES" ]; then | ||
source .venv/bin/activate | ||
echo "Installing packages: $DEPENDENCIES" | ||
pip install $DEPENDENCIES | ||
fi | ||
- run: pip freeze --all | ||
- name: List 3rd-party stub dependencies installed | ||
run: | | ||
source .venv/bin/activate | ||
pip freeze --all | ||
- name: Get pyright version | ||
uses: SebRollen/[email protected] | ||
id: pyright_version | ||
|
@@ -147,13 +155,15 @@ jobs: | |
python-platform: ${{ matrix.python-platform }} | ||
python-version: ${{ matrix.python-version }} | ||
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. | ||
venv-path: . | ||
- name: Run pyright with stricter settings on some of the stubs | ||
uses: jakebailey/pyright-action@v1 | ||
with: | ||
version: ${{ steps.pyright_version.outputs.value }} | ||
python-platform: ${{ matrix.python-platform }} | ||
python-version: ${{ matrix.python-version }} | ||
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. | ||
venv-path: . | ||
project: ./pyrightconfig.stricter.json | ||
- name: Run pyright on the test cases | ||
uses: jakebailey/pyright-action@v1 | ||
|
@@ -162,6 +172,7 @@ jobs: | |
python-platform: ${{ matrix.python-platform }} | ||
python-version: ${{ matrix.python-version }} | ||
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. | ||
venv-path: . | ||
project: ./pyrightconfig.testcases.json | ||
|
||
stub-uploader: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that it isn't going to work for people who prefer to name their venv something else? I usually name it
env
. It might not be a problem for me, because I don't run pyright locally very often.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it will mean that. FWIW, I also prefer
env
as a name for my local virtual environments (it's fewer characters to type), but went with.venv
here since it's the name recommended by our CONTRIBUTING docs:typeshed/CONTRIBUTING.md
Line 59 in ae0c9f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.venv
is also what's configured for flake8, gitignore, and isort.mypy_test and regr_test use a temp directory anyway, but it's also using
.venv
So it's pretty established that the standard for typeshed is to name the virtual environment folder
.venv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still prefer passing it in a command-line option instead of hard-coding it in the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would I, but if I'm reading the docs for pyright correctly, I don't think that's an option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently pyright has a
-v, --venv-path
option whose purpose is exactly this. From the docs:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
venv-path
option can be set via the command line (and I do in this PR, via pyright-action). But thevenv-path
option is meant to point to a directory in which there might be multiple different virtual environments, if I'm reading the pyright docs correctly, meaning it's useless to set thevenv-path
option on the command line unless you also set thevenv
option in the config file. Thevenv
option is what tells pyright which venv it should select out of the ones it finds in the path specified byvenv-path
.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the more detailed docs here, which the command-line docs link to, and which dig into the distinction between the
venvPath
andvenv
settings: https://github.com/microsoft/pyright/blob/main/docs/configuration.md#main-configuration-options(
venvPath
in the config file is equivalent tovenv-path
on the command line)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently there's no way to set this on the command line.