Replies: 1 comment 4 replies
-
|
I think the awkward part here is specifically
I’d look at it like this:
So the cleaner approach is probly to run pyright in the project context instead of as a detached Something along these lines feels more natural: uv run pyrightor, if you want it pinned as a dev dependency, add pyright to the project and run it through the project env rather than through That way you’re lining pyright up with the same So yeah, I think your intuition is right:
In other words, I’d treat |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What is the recommended way to tell
pyrightaboutvenvpath when usinguvx pyright[nodejs]?When I run that command without proper configuration, I get lots of missing import errors. This suggests that
pyrightisn't automatically/correctly detecting the project's.venvpath. I suspect this issue occurs becauseuvxruns commands in a temporary environment, isolated from the current project's virtual environment.I initially fixed this by adding
venvPath = "."andvenv = ".venv"to the[tool.pyright]section in mypyproject.toml. However, using venvPath is discouraged for specifying the project environment.[1]uvx pyright[nodejs] --venvpath .fails to detect the environment (there is no--venvoption defined for cli call)uvx pyright[nodejs] --pythonpath .venv/Scripts/pythonworks, but it is not straightforward to type and not cross-platform (the path is.venv/bin/pythonon linux).BTW, running
uvx ty checkoruvx pyrefly checkworks as expected without additional settings, I wonder ifpyrightcan implement the same.venvdetection mechanism as those.Beta Was this translation helpful? Give feedback.
All reactions