jakebailey / pyright-action Goto Github PK
View Code? Open in Web Editor NEWGitHub Action for pyright
License: MIT License
GitHub Action for pyright
License: MIT License
After bumping from v2.0.2
to v2.1.0
I now get:
Run jakebailey/[email protected]
with:
working-directory: backend
version: 1.1.348
no-comments: false
warnings: false
lib: false
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.8/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.8/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.8/x64/lib
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module './impl/format'
Require stack:
- /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4282:25
at /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4272:17
at node_modules/jsonc-parser/lib/umd/main.js (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4278:7)
at __require (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:12:50)
at Object.<anonymous> (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:8109:35)
at Module._compile (node:internal/modules/cjs/loader:1241:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js'
]
}
Node.js v20.8.1
when running
- name: Run Pyright
uses: jakebailey/[email protected]
with:
working-directory: "backend"
version: 1.1.348
Downgrading to v2.0.2
fixes the issue:
Run jakebailey/[email protected]
with:
working-directory: backend
version: 1.1.348
no-comments: false
warnings: false
lib: false
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.8/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.8/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.8/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.8/x64/lib
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/c4b17f4f-5b08-4e65-8fd7-59db68d2ec54 -f /home/runner/work/_temp/e2383b4c-ca59-4abf-b8c8-ab0fba725d0e
pyright 1.1.348, node v20.8.1, pyright-action 2.0.2
Working directory: /home/runner/work/project/project/backend
Running: /home/runner/runners/2.313.0/externals/node20/bin/node /opt/hostedtoolcache/pyright/1.1.348/x64/package/index.js --outputjson
0 errors, 0 warnings, 0 informations
Hi! I would like pyright-action
to provide a way through configuration to disable Problem Matcher annotations. This can cause irritation in some projects that still have lots of warnings. See mhammond/pywin32#2102 (comment) for example. Especially for unchanged files (since GitHub doesn't allow configuring that Beta feature): actions/toolkit#457 & https://github.com/orgs/community/discussions/81472
From https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers and https://stackoverflow.com/a/65964721 I read it should be possible to disable them, by adding a step - run: echo "::remove-matcher owner=pyright::"
, but that didn't seem to work. Even if it did, it's not well-publicised or known.
Hola! Thanks for helping to make such a great tool that makes type checking our team's Python much easier! 😄
I've been trying to implement pyright
into a GitHub Actions pipeline recently, and I've kept running into this error. Pyright should be pretty up to date, and what's weird is that if I run it locally (with the same flags, including the version/platform/JSON flags), it works fine. A nice big blob of JSON is output.
I wonder if it's just too much JSON for one part of the program to handle? Running the same command locally produces ~17000 lines of JSON output.
Here's the output of our GitHub Actions step, if that helps:
pyright 1.1.260, node v16.13.0, pyright-action 1.3.0
/actions-runner/externals/node16/bin/node /opt/hostedtoolcache/pyright/1.1.260/x64/package/index.js --outputjson --pythonplatform Linux --pythonversion 3.8 NaviGator/gnc/navigator_controller/nodes/gps_to_baselink_odom.py NaviGator/gnc/navigator_controller/nodes/mrac_controller.py ...other python files...
Loading configuration file at /tmp/runners/diamond/work/mil/mil/pyrightconfig.json
stubPath /tmp/runners/diamond/work/mil/mil/typings is not a valid directory.
Searching for source files
Found 443 source files
**Error: Unexpected end of JSON input**
Here's our pyrightconfig.json
file, too, if that helps in debugging:
{
"exclude": [
"deprecated",
"docs",
"NaviGator/simulation/VRX",
"NaviGator/perception/darknet_ros"
],
"reportMissingTypeStubs": false,
"pythonVersion": "3.8",
"pythonPlatform": "Linux"
}
Thank you for your time. Have a good weekend!
I had been aware of this action for some time, but never bothered to use it because this
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: npm install -g pyright
- run: pyright my_code
wasn't that difficult to configure, but now I've realized that your action actually produces annotations that appear in the PR! This is definitely your killer feature!
Activating skipunannotated yields
Run jakebailey/pyright-action@v1
/usr/bin/docker exec 0570a425a99594c7f7200fb917406d6e67ce96052308507cba4db691694b18bd sh -c "cat /etc/*release | grep ^ID"
pyright 1.1.232, node v16.20.2, pyright-action 1.7.0
/__e/node16/bin/node /__t/pyright/1.1.232/x64/package/index.js --skipunannotated true --outputjson
Loading configuration file at /sage/pyrightconfig.json
Assuming Python platform Linux
stubPath /sage/typings is not a valid directory.
Searching for source files
File or directory "/sage/true" does not exist.
No source files found.
It might be because of the old version (that we have to use for some unrelated reason), but I think the args should be simply --skipunannotated --outputjson
instead of --skipunannotated true --outputjson
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (helpers:pinGitHubActionsDigests)
my github action is failing on this step with "Error: {"error":"Service Unavailable"}"
Looks like 1.1.168
broke our CI pipelines. The errors indicate that pyright isn't able to resolve some of our stubs/typings. Unfortunately, I don't see anything obvious in the last couple commits :/
Pinning the action to 1.1.167
restores proper functionality.
Python 3.9.6
For some reason, PyRight makes one specify venvPath
together with venv
.
How to specify a venv with this action? extra-args: '--venv=...'
doesn’t seem to work (“unexpected option --venv
”)
I have Dependabot setup for many of my projects, and i have 4 automatic PRs for upgrading to 2.1.0, and for all of them the checks fail (which is just testing out the pyright action)
All 4 projects use pyright action once for Linux and once for Windows as the python platform, so i got the following error in the exact same way a total amount of 8 times.
Run jakebailey/[email protected]
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module './impl/format'
Require stack:
- /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4282:25
at /home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4272:17
at node_modules/jsonc-parser/lib/umd/main.js (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:4278:7)
at __require (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:12:50)
at Object.<anonymous> (/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js:8109:35)
at Module._compile (node:internal/modules/cjs/loader:1241:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/work/_actions/jakebailey/pyright-action/v2.1.0/dist/index.js'
]
}
Node.js v20.8.1
Hi, thanks for this GH action!
I'm trying to use it with a venv so that the library stubs are available, but I still get this error:
error: Import "numpy" could not be resolved (reportMissingImports)
https://github.com/openai/gym/runs/4526885810
Any hint on what I'm doing wrong? Since pyright doesn't complain about venv, I assume I have passed the path correctly.
When I run the action on my repro, it fails with Error: Unexpected end of JSON input
. I use Pyright with VSC for the same source files, and it never complains. Here is the output from GitHub Actions:
...
2022-03-14T21:23:32.4948882Z ##[group]Run jakebailey/pyright-action@v1
2022-03-14T21:23:32.4949427Z with:
2022-03-14T21:23:32.4949756Z working-directory: backend
2022-03-14T21:23:32.4950120Z typeshed-path: typings
2022-03-14T21:23:32.4950568Z lib: false
2022-03-14T21:23:32.4951266Z warnings: false
2022-03-14T21:23:32.4951508Z no-comments: false
2022-03-14T21:23:32.4951820Z env:
2022-03-14T21:23:32.4952109Z pythonLocation: /opt/hostedtoolcache/Python/3.10.2/x64
2022-03-14T21:23:32.4952447Z ##[endgroup]
2022-03-14T21:23:32.8064249Z pyright 1.1.229
2022-03-14T21:23:32.9417607Z [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/b25e2c0a-a3be-4856-9f15-528888bdeb08 -f /home/runner/work/_temp/99adb54d-05b7-4495-bb6d-cafb873a3e67
2022-03-14T21:23:33.2811323Z No configuration file found.
2022-03-14T21:23:33.2818455Z pyproject.toml file found at /home/runner/work/myproject/myproject/backend.
2022-03-14T21:23:33.2821073Z Loading pyproject.toml file at /home/runner/work/myproject/myproject/backend/pyproject.toml
2022-03-14T21:23:33.2864765Z No include entries specified; assuming /home/runner/work/myproject/myproject/backend
2022-03-14T21:23:33.3319394Z Searching for source files
2022-03-14T21:23:33.3613923Z Found 71 source files
2022-03-14T21:23:39.8617072Z ##[error]Unexpected end of JSON input
2022-03-14T21:23:39.8720539Z Post job cleanup.
2022-03-14T21:23:40.0238946Z [command]/usr/bin/git version
2022-03-14T21:23:40.0295210Z git version 2.35.1
...
Here is the Pyright part of my pyproject.toml
file:
[tool.pyright]
pythonVersion = "3.10"
pythonPlatform = "Linux"
typeCheckingMode = "strict"
exclude = ["migrations", "node_modules", "typings", "bin"]
stubPath = "typings"
logLevel = "Trace"
enableTypeIgnoreComments = true
useLibraryCodeForTypes = true
autoImportCompletions = true
completeFunctionParens = true
reportImportCycles = "none"
reportMissingTypeStubs = "information"
reportIncompatibleVariableOverride = "none"
Hey!
Firstly I want to add that I think this is a me issue and not a you issue, haha.
I cannot get the action to annotate my codebase/PRs/commits, as it is designed to do and I'm struggling to figure out why.
The repo I'll use is this one. The job for running this action is here. If you check the history of that file you can see I edited it a few times as a test.
Any help would be appreciated but I understand if it's out of scope for this issue tracker!
Thanks for a great action,
It would be nice to be able to pin the pyright version used but have in automatically upgraded. Would it be possible to specify the version of pyright in a package.json file or similar such that dependabot or similar tool automatically can update the version when a new pyrigth version is released. Could this be possible?
The newest version on pypi https://pypi.org/project/pyright/ is 1.1.331:
Sorry for the poorly explained issue.
I'm using your action in a context with poetry
(using the snok/install-poetry
action).
It seems that unless I explicitly use pip install .
to install the deps manually then the action fails to resolve the output.
Here is both my config and an action output from a pip install .
:
Config: https://github.com/AbstractUmbra/Hondana/blob/7abb4b7f648a4fff4213210e20e0d9767014577c/.github/workflows/coverage_and_lint.yaml#L63-L79
Action: https://github.com/AbstractUmbra/Hondana/actions/runs/4145028232/jobs/7168844087 (Run Pyright step)
Here it is with a poetry installed one:
Config: https://github.com/AbstractUmbra/Hondana/blob/a8653a55a0208a371f9b7248f1bfe8824472066d/.github/workflows/coverage_and_lint.yaml#L57-L71
Action: https://github.com/AbstractUmbra/Hondana/actions/runs/4145136918/jobs/7169102398
I assume this is related to how pyright
itself resolves the venv path. I asked about this in another issue and locally on my server this works fine as you can see here:
$ poetry install
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: Hondana (3.4.7)
$ poetry run python3 -c "import sys; print(sys.path)"
['', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/home/penumbra/.cache/pypoetry/virtualenvs/hondana-epKOD00U-py3.9/lib/python3.9/site-packages', '/home/penumbra/projects/personal/hondana']
$ poetry run pyright
No configuration file found.
pyproject.toml file found at /home/penumbra/projects/personal/hondana.
Loading pyproject.toml file at /home/penumbra/projects/personal/hondana/pyproject.toml
Assuming Python version 3.9
Assuming Python platform Linux
stubPath /home/penumbra/projects/personal/hondana/typings is not a valid directory.
Searching for source files
Found 68 source files
pyright 1.1.290
0 errors, 0 warnings, 0 informations
Completed in 5.04sec
I'm now wondering if perhaps my config is incorrect or so?
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
actions/checkout
, codecov/codecov-action
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)@vitest/coverage-v8
, vitest
)semver
, @types/semver
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/actions/setup/action.yml
actions/setup-node v4.0.2@60edb5dd545a775178f52524783378180af0d1f8
pnpm/action-setup v3.0.0@a3252b78c470c02df07e9d59298aecedc3ccdd6d
actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
.github/workflows/ci.yml
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
codecov/codecov-action v4.3.0@84508663e988701840491b86de86b666e8a86bed
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
actions/setup-python v5.1.0@82c7e631bb3cdc910f68e0081d67478d79c6982d
package.json
@actions/core ^1.10.1
@actions/http-client ~2.1.1
@actions/tool-cache ^2.0.1
@badrap/valita ^0.3.8
@iarna/toml ^2.2.5
jsonc-parser ^3.2.1
semver ^6.3.1
shell-quote ^1.8.1
which ^4.0.0
@tsconfig/node20 ^20.1.4
@tsconfig/strictest ^2.0.5
@types/node ^20.12.7
@types/semver ^6.2.7
@types/shell-quote ^1.7.5
@types/which ^3.0.3
@typescript-eslint/eslint-plugin ^7.6.0
@typescript-eslint/parser ^7.6.0
@vitest/coverage-v8 ^1.5.0
dprint ^0.45.1
esbuild ^0.20.2
eslint ^8.57.0
eslint-plugin-simple-import-sort ^12.0.0
eslint-plugin-unicorn ^52.0.0
husky ^9.0.11
jest-serializer-path ^0.1.15
klona ^2.0.6
rimraf ^5.0.5
typescript ~5.4.5
vitest ^1.5.0
node >=20
pnpm 8.15.6+sha256.01c01eeb990e379b31ef19c03e9d06a14afa5250b82e81303f88721c99ff2e6f
The latest version of Pyright seems not to parse
Hello!
I'm not even sure where to begin with this bug report.
I believe I have either misunderstood how to set up this action, or it will not catch obvious errors.
I noticed it during this run, where the Type Coverage
step passed successfully, however there were numerous type errors relating to return type were completely missed.
My action specification at the time looked like this, which should have inherited from the pyproject.toml
file outlined here.
I have managed to manually install node, and run pyright manually in an action to verify that it will actually return these results, this can be viewed here in the "Run Pyright" step.
Could you please let me know if this is an issue with the action, or me? I very much like and appreciate the features you offer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.