Option to use workspace version of Pyright with Pylance #4440
Replies: 6 comments
-
@etripier, see #4375. This is not possible given the current architecture of Pylance/Pyright and changing this would require significant effort on our side. Triage: Move to enhancement discussion to track up-votes? |
Beta Was this translation helpful? Give feedback.
-
Another solution here might be to have a CLI for pylance. Then the CI could just pull the latest one of Pylance and it should always match. |
Beta Was this translation helpful? Give feedback.
-
Ok, I see - that is unfortunate. I think the Pylance CLI thing will be even more problematic in that CI will now break on a new Pyright release, which is definitely a no-go for us. It sounds like the only solutions, barring a massive refactor of Pylance, are to have all of the developers pin the extension version or install the Pyright extension. We'll go with the former for now, but - if y'all have any pull with the Microsoft devs working on VSCode, would you tap them to support setting workplace extension version recommendations? It seems like they really don't want to based on microsoft/vscode#138048 (comment), but who knows, maybe they'll listen to someone who isn't an annoying consumer. VSCode dev containers look interesting but require even more effort from our developers to set up. Anyway, much love for the extension. It's made working in Python actually tolerable, which is something I never thought I'd type. |
Beta Was this translation helpful? Give feedback.
-
Big upvote on this. We have a large monorepo that has all sort of edge cases in it. |
Beta Was this translation helpful? Give feedback.
-
This is a bit out there but you could create an extension that reads |
Beta Was this translation helpful? Give feedback.
-
Our team has talked about this and we decided we won't be doing this since it'd be too costly to implement this. However you can reference this docs to learn how you can specify a Pylance version when running pyright in the CI: https://github.com/microsoft/pylance-release/blob/main/USING_WITH_PYRIGHT.md#pyright-version-and-pylances-underlying-pyright-version-are-different |
Beta Was this translation helpful? Give feedback.
-
We're using Pylance in combination with an independent version of Pyright (for pre-commit hooks and CI). When Pylance is updated we have to rush to update our version of Pyright - otherwise, the issues reported by VSCode are mismatched with the results from the Pyright CLI (our source of truth).
This is, unfortunately, quite frustrating. Asking all of our developers to pin a specific version of Pylance is not a great solution because that requires manual effort on their end for every update - VSCode does not make it easy to set versioned extension recommendations either.
VSCode offers the ability to specify the version of TypeScript used:
Would it be much trouble to allow Pylance to use the workspace version of Pyright (if available in NODEPATH)?
Beta Was this translation helpful? Give feedback.
All reactions