-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Move venv and conda env discovery to SearchPath::from_settings
#18938
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
crates/ruff_db/src/ranged_value.rs
Outdated
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
CodSpeed WallTime Performance ReportMerging #18938 will not alter performanceComparing Summary
|
763f6ac to
f66c43c
Compare
|
|
Hmm, not sure what's up with the benchmark. The auto discovery isn't run for benchmarks (it's a fixed environment) and the program settings are resolved outside the benchmark I verified that both main and this PR perform the same search path discovery in the benchmark... Edit: It seems the benchmark triggers on other PRs too. So maybe just a flake? |
AlexWaygood
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.
Thanks! This looks basically good. I still feel like there's some confusing distinctions being introduced that I'm not totally sold on.
It would also be ideal if we could add a regression test for #18938 (comment), but it was obviously a pre-existing issue that we had no coverage there :-)
crates/ty_test/src/lib.rs
Outdated
| .python() | ||
| .map(|sys_prefix| { | ||
| PythonPath::IntoSysPrefix( | ||
| PythonPath::sys_prefix( |
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.
is the sys_prefix method useful if this is all it does? 😆
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.
It wasn't introduced by me!
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 know! 😆
AlexWaygood
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.
Thank you! The new names make it much clearer
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
It's a shame that I'll delete the entire enum in my next PR :D |
* main: [ty] Add builtins to completions derived from scope (#18982) [ty] Don't add incorrect subdiagnostic for unresolved reference (#18487) [ty] Simplify `KnownClass::check_call()` and `KnownFunction::check_call()` (#18981) [ty] Add micro-benchmark for #711 (#18979) [`flake8-annotations`] Make `ANN401` example error out-of-the-box (#18974) [`flake8-async`] Make `ASYNC110` example error out-of-the-box (#18975) [pandas]: Fix issue on `non pandas` dataframe `in-place` usage (PD002) (#18963) [`pylint`] Fix `PLC0415` example (#18970) [ty] Add environment variable to dump Salsa memory usage stats (#18928) [`pylint`] Fix `PLW0108` autofix introducing a syntax error when the lambda's body contains an assignment expression (#18678) Bump 0.12.1 (#18969) [`FastAPI`] Add fix safety section to `FAST002` (#18940) [ty] Add regression test for leading tab mis-alignment in diagnostic rendering (#18965) [ty] Resolve python environment in `Options::to_program_settings` (#18960) [`ruff`] Fix false positives and negatives in `RUF010` (#18690) [ty] Fix rendering of long lines that are indented with tabs [ty] Add regression test for diagnostic rendering panic [ty] Move venv and conda env discovery to `SearchPath::from_settings` (#18938)
Summary
This PR centralizes the auto discovery logic for a Python environment into
SearchPaths::from_settings.This should make astral-sh/ty#611 an easy change (manly prioritizing
.venvoverCONDA_PREFIX).Test Plan
Existing tests