-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CI: use github action for pyright #47067
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
Closed
Closed
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 |
---|---|---|
|
@@ -67,15 +67,6 @@ jobs: | |
environment-file: ${{ env.ENV_FILE }} | ||
use-only-tar-bz2: true | ||
|
||
- name: Install node.js (for pyright) | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
|
||
- name: Install pyright | ||
# note: keep version in sync with .pre-commit-config.yaml | ||
run: npm install -g [email protected] | ||
|
||
- name: Build Pandas | ||
id: build | ||
uses: ./.github/actions/build_pandas | ||
|
@@ -100,6 +91,12 @@ jobs: | |
run: ci/code_checks.sh typing | ||
if: ${{ steps.build.outcome == 'success' }} | ||
|
||
- uses: jakebailey/pyright-action@v1 | ||
with: | ||
# note: keep version in sync with .pre-commit-config.yaml | ||
version: 1.1.247 | ||
extra-args: --skipunannotated | ||
|
||
- name: Run docstring validation script tests | ||
run: pytest scripts | ||
if: ${{ steps.build.outcome == 'success' }} | ||
|
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.
Curious, why do we need this in pre-commit-config and here i.e. can this just be run in pre-commit?
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.
pyright is only run by pre-commit during the
manual
stage. The idea is to give developers an easy way to run pyright without having to set it up (it depends on node). The CI doesn't run themanual
stage.I think the reason to keep mypy and pyright separate was that otherwise all the typing packages would need to be installed for the pre-commit hook. Maybe there was a better reason :)
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 reason for not running pyright&mypy (by default) in pre-commit is that outdated/missing packages (e.g., numpy) would cause pyright&mypy to fail. We often have issues between numba requiring an older version of numpy but for typing we want the latest numpy.
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.
@Dr-Irv I think you set the pyright github action for https://github.com/pandas-dev/pandas-stubs up. How did you manage that pyright finds the virtual env? Running pyright directly (instead of using the github action) seemed to have no issue finding the virtual env.
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.
Make sense for typing checks in pre-commit to not necessarily run on every commit and therefore in
manual
mode. Is it possible to have the pre-commit job run these pyright checks then in the CI? My motivation is to see if there can be one clear way to run these checks.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.
It would be great to only use pre-commit and make mypy&pyright optional!
I think one issue with mypy+pre-commit is that pre-commit isolates the python environment (can probably be avoided by
language: system
)? Pyright doesn't seem to be affected by that since pre-commit doesn't seem to isolate non-python programs.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 just copied the action from what Microsoft had set up in https://github.com/microsoft/python-type-stubs/blob/main/.github/workflows/test.yml . I think since it is a sequence of steps, the virtual env is automatically set up from the previous steps.