-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Use python version and path from Python extension #19012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
fa7d08f to
0de50c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
If the extension isn't able to give us the Python version but is able to give us the Python executable (for some reason), will we infer the Python version from that executable the same way as we would with a virtual environment that had been activated?
Yes, we would try to infer the version from the environment. |
dhruvmanila
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
| pub(crate) executable: PythonExecutable, | ||
| pub(crate) environment: Option<PythonEnvironment>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need both the executable and the environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this would probably allow us to show some kind of warning if the selected Python version in an editor is different than the configured Python version or even if there's a mismatch in the selected and used virtual environment even though the Python version might be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mainly thought that I'm not to picky about what we should send to the server and let the server decide what information it needs
| ValueSource::PythonVSCodeExtension => { | ||
| unreachable!("Can't configure rules from the Python VSCode extension") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this and other unreachables correctly, we need to decide whether we want to support these overrides (rules, includes, excludes) to be set in the editor settings, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Once we do, we'd need to implement the match arms.
|
That's a smart way of testing this out! |
0de50c6 to
2e35bfd
Compare
* dcreager/merge-arguments: (223 commits) fix docs Combine CallArguments and CallArgumentTypes [ty] Sync vendored typeshed stubs (#19334) [`refurb`] Make example error out-of-the-box (`FURB122`) (#19297) [refurb] Make example error out-of-the-box (FURB177) (#19309) [ty] ignore errors when reformatting codemodded typeshed (#19332) [ty] Provide docstrings for stdlib APIs when hovering over them in an IDE (#19311) [ty] Add virtual files to the only project database (#19322) Add t-string fixtures for rules that do not need to be modified (#19146) [ty] Remove `FileLookupError` (#19323) [ty] Fix handling of metaclasses in `object.<CURSOR>` completions [ty] Use an interval map for scopes by expression (#19025) [ty] List all `enum` members (#19283) [ty] Handle configuration errors in LSP more gracefully (#19262) [ty] Use python version and path from Python extension (#19012) [`pep8_naming`] Avoid false positives on standard library functions with uppercase names (`N802`) (#18907) Update Rust crate toml to 0.9.0 (#19320) [ty] Fix server version (#19284) Update NPM Development dependencies (#19319) Update taiki-e/install-action action to v2.56.13 (#19317) ...
Summary
Uses the python version and environment selected in the Python extension as a fallback if the configuration doesn't specify a version or environment respectively.
Depends on astral-sh/ty-vscode#65
Closes astral-sh/ty-vscode#26
Test Plan
Screen.Recording.2025-07-10.at.14.23.50.mov