Skip to content

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Jun 26, 2025

Summary

This PR moves the discovery of the Python environment from SearchPaths::from_settings to Options::to_program_settings. This allows us to remove the PythonEnvironmentPath enum which we used to parametrize SearchPaths::from_settings whether it should discover the site packages paths because we didn't want that behavior in tests or when the user explicitly specified an environment.

I didn't move site_packages.rs because we depend on it from ty_test and moving it to ty_project would require introducing a new dependency.

Test Plan

@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Jun 26, 2025
@MichaReiser MichaReiser marked this pull request as draft June 26, 2025 14:41
Copy link
Contributor

github-actions bot commented Jun 26, 2025

mypy_primer results

No ecosystem changes detected ✅

@MichaReiser MichaReiser force-pushed the micha/remove-python-environment-path branch 2 times, most recently from 464dce8 to e797bf9 Compare June 26, 2025 14:50
@MichaReiser MichaReiser added the internal An internal refactor or improvement label Jun 26, 2025
Comment on lines -569 to -570
Cause: Invalid search path settings
Cause: Failed to discover the site-packages directory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could try to add those again but I actually don't find them very useful (the message on line 571 contains everything the user needs to know)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I agree, it seems nicer this way. More concise but no less information.

@MichaReiser MichaReiser force-pushed the micha/remove-python-environment-path branch from e797bf9 to 328ef2d Compare June 26, 2025 14:56
@MichaReiser MichaReiser marked this pull request as ready for review June 26, 2025 14:56
Copy link
Contributor

github-actions bot commented Jun 26, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is so much better

@MichaReiser MichaReiser merged commit 1dcdf7f into main Jun 26, 2025
35 checks passed
@MichaReiser MichaReiser deleted the micha/remove-python-environment-path branch June 26, 2025 15:57
dcreager added a commit that referenced this pull request Jun 27, 2025
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement ty Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants