Comments (5)
The comments above were specifically that nobody should be using the "venv" or "venv-path" flags of pyright; you can definitely use a virtualenv with this action. See this comment for my poetry recommendation: #10 (comment)
from pyright-action.
I don't recommend using venv/venvPath in pyright at all; the option is pretty specific to Eric's team's monorepo. For normal use, you should be getting the right venv onto PATH, or the right interpreter selected in your editor in the Python extension.
If you have a venv in CI, you will have much better success activating it in a previous step, but largely, it doesn't seem all that common to actually use a venv in CI.
from pyright-action.
I'm pretty sure the error is because those options can only be set in a config file, not via a flag. Which, again, is the byproduct of how this option works in pyright.
from pyright-action.
The thing is, if you're using setup-python
with poetry and caching you need to use a virtualenv. Specifically, this config: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
- run: poetry install
Installing the dependencies for each run takes a lot of time (2-3 minutes for one of my repos) and with caching it only takes 6 seconds so caching helps a lot.
Naturally I could tell poetry to install right into the system dependencies but that makes caching impossible so I have to use a virtualenv here.
In case anyone else is running into this issue, this seems to work for me:
- name: Get the Python bin path from poetry
run: echo "PYTHON_BIN=$(poetry run which python)" >> $GITHUB_ENV
- name: Linting with pyright
uses: jakebailey/pyright-action@v1
with:
python-path: ${{ env.PYTHON_BIN }}
extra-args: cf/${{ inputs.project }}
I tried python env info --path
first but that step failed without a clear error. At the very least this method works both with container: ubuntu
and a regular Github action run but it might not work for Windows jobs.
from pyright-action.
I've stuck some usage examples in the README to make this clearer.
from pyright-action.
Related Issues (20)
- Module resolution change HOT 1
- Question: what's the recommended way to get stubs installed? HOT 2
- Support --verifytypes HOT 7
- `Unexpected end of JSON input` when running action HOT 14
- `Unexpected end of JSON input` error when using action vs locally HOT 7
- Support for bumping pyright version using dependabot HOT 15
- Action fails to resolve package when installed with `poetry` HOT 30
- service is down? HOT 1
- The README should mention that this action produces annotations HOT 1
- Dependency Dashboard
- Action Required: Fix Renovate Configuration
- Fails for Pyright version `1.1.330.post0` HOT 3
- The newest pyright version is 1.1.331 but action prints 1.1.332 HOT 2
- Using skipunannotated throws error HOT 3
- Service Unavailable HOT 10
- Bumping from `v2.0.2` to `v2.1.0` raises `Error: Cannot find module './impl/format'` HOT 2
- 2.1.0 seems to be broken HOT 1
- Feature Request: Disable GitHub Problem Matcher annotations HOT 11
- Can't get annotations to run on repo code HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyright-action.