ruff/crates/red_knot_python_semantic/src
Micha Reiser 067c6de465
Change `EnvironmentOptions::venv-path` to `Option<SystemPathBuf>` (#15631)
## Summary

The `Options` struct is intended to capture the user's configuration
options but
`EnvironmentOptions::venv_path` supports both a `SitePackages::Known`
and `SitePackages::Derived`.

Users should only be able to provide `SitePackages::Derived`—they
specify a path to a venv, and Red Knot derives the path to the
site-packages directory. We'll only use the `Known` variant once we
automatically discover the Python installation.

That's why this PR changes `EnvironmentOptions::venv_path` from
`Option<SitePackages>` to `Option<SystemPathBuf>`.

This requires making some changes to the file watcher test, and I
decided to use `extra_paths` over venv path
because our venv validation is annoyingly correct -- making mocking a
venv rather involved.

## Test Plan

`cargo test`
2025-01-21 14:10:41 +00:00
..
module_resolver Change `EnvironmentOptions::venv-path` to `Option<SystemPathBuf>` (#15631) 2025-01-21 14:10:41 +00:00
semantic_index [red-knot] Use `BitSet::union` for merging of declarations (#15451) 2025-01-13 11:10:42 +01:00
types [red-knot] Rename `bindings_ty`, `declarations_ty` (#15618) 2025-01-20 15:23:33 +01:00
util [red-knot] Improve ergonomics for the `PySlice` trait (#13983) 2024-10-29 20:40:59 +00:00
ast_node_ref.rs `@no_type_check` support (#15122) 2024-12-30 09:42:18 +00:00
db.rs Add support for configuring knot in `pyproject.toml` files (#15493) 2025-01-17 09:41:06 +01:00
lib.rs Add `invalid-ignore-comment` rule (#15094) 2024-12-23 10:38:10 +00:00
lint.rs Add `unknown-rule` (#15085) 2024-12-23 11:30:54 +01:00
module_name.rs Bind top-most parent when importing nested module (#14946) 2024-12-16 16:15:40 -05:00
node_key.rs [red-knot] Use memory address as AST node key (#14317) 2024-11-13 14:35:54 +01:00
program.rs Change `EnvironmentOptions::venv-path` to `Option<SystemPathBuf>` (#15631) 2025-01-21 14:10:41 +00:00
python_platform.rs Remove workspace support (#15472) 2025-01-15 09:03:38 +01:00
python_version.rs Add tracing support to mdtest (#14935) 2024-12-13 09:10:01 +00:00
semantic_index.rs [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
semantic_model.rs [red-knot] Unify `setup_db()` functions, add `TestDb` builder (#14777) 2024-12-04 21:36:54 +01:00
site_packages.rs Rename `custom-typeshed-dir`, `target-version` and `current-directory` CLI options (#14930) 2024-12-13 08:21:52 +00:00
stdlib.rs [red-knot] Rename and rework the `CoreStdlibModule` enum (#15071) 2024-12-19 20:59:00 +00:00
suppression.rs Add `invalid-ignore-comment` rule (#15094) 2024-12-23 10:38:10 +00:00
symbol.rs [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
types.rs [red-knot] Heterogeneous tuple types with differently ordered (but equivalent) unions at the same index should be considered equivalent (#15637) 2025-01-21 12:51:20 +00:00
unpack.rs Allow assigning ellipsis literal as parameter default value (#14982) 2025-01-05 13:11:32 -06:00
visibility_constraints.rs Narrowing for class patterns in match statements (#15223) 2025-01-07 15:58:12 -05:00