[ty] Move venv and conda env discovery to SearchPath::from_settings#18938
[ty] Move venv and conda env discovery to SearchPath::from_settings#18938MichaReiser merged 7 commits intomainfrom
SearchPath::from_settings#18938Conversation
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.
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.
is the sys_prefix method useful if this is all it does? 😆
There was a problem hiding this comment.
It wasn't introduced by me!
AlexWaygood
left a comment
There was a problem hiding this comment.
Thank you! The new names make it much clearer
Co-authored-by: Alex Waygood <[email protected]>
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