Add Pyright to GitHub Actions CI#18345
Merged
SaschaCowley merged 7 commits intomasterfrom Jun 27, 2025
Merged
Conversation
Member
|
This might have neater output but might not work with our uv setup https://github.com/jordemort/action-pyright |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR integrates Pyright static type analysis into the CI/CD pipeline by introducing a dedicated GitHub Actions job and a PowerShell script to execute and report Pyright results. Key changes include:
- Adding the SynthCommand import and appropriate type annotations in the SAPI4 driver.
- Configuring Pyright to ignore specific directories via pyproject.toml.
- Creating a new PowerShell script and integrating it into the CI workflow, along with adjusting pre-commit settings.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source/synthDrivers/sapi4.py | Added SynthCommand in import list and updated type annotation for supportedCommands. |
| pyproject.toml | Added ignore setting to exclude the .venv directory from Pyright analysis. |
| ci/scripts/tests/typeCheck.ps1 | Created a new script to run Pyright and append its output to the GitHub step summary on failure. |
| .pre-commit-config.yaml | Updated configuration to skip Pyright in pre-commit CI. |
| .github/workflows/testAndPublish.yml | Added a new job that runs the Pyright type check as part of the CI workflow. |
Comments suppressed due to low confidence (1)
ci/scripts/tests/typeCheck.ps1:3
- [nitpick] Consider adding a brief comment explaining the use of 'uv run pyright' instead of calling Pyright directly, to aid future maintainers in understanding this choice.
$pyrightOutput = (uv run pyright) -Join "`n"
seanbudd
added a commit
that referenced
this pull request
Jul 30, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Link to issue number:
Closes #17794
Summary of the issue:
Currently, pyright is not running as part of Pre-commit CI, GitHub Actions CI, or Appveyor.
Description of user facing changes:
None.
Description of developer facing changes:
Pyright static type analysis now happens as part of CI/CD.
There is now only one pyright action as part of pre-commit, and it is skipped on pre-commit CI.
Description of development approach:
Create a power shell script to run pyright and append its output to the GitHub step summary on failure.
Add a job to
testAndPublish.ymlthat runs this script.Note the job relies on build NVDA as COM Interfaces may be used as part of type analysis, but are built by SCons.
Update type annotations in the SAPI4 driver to fix a Pyright error
Add
tool.pyright.ignoretopyproject.tomlwith just.venvin it, to prevent Pyright flagging typing errors in dependencies.Testing strategy:
Check workflows on PR.
Known issues with pull request:
None
Code Review Checklist:
@coderabbitai summary