Omit interpreter path during uv venv with managed Python (#5311)

e.g. 
```
❯ cargo run -q -- venv --preview
Using Python 3.12.1
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

instead of 

```
❯ cargo run -q -- venv --preview
Using Python 3.12.1 interpreter at: /Users/zb/Library/Application Support/uv/python/cpython-3.12.1-macos-aarch64-none/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```
This commit is contained in:
Zanie Blue 2024-07-23 15:20:23 -04:00 committed by GitHub
parent 3a85353707
commit 6fe9bd8a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 10 deletions

View file

@ -1244,6 +1244,12 @@ impl PythonRequest {
}
}
impl PythonSource {
pub fn is_managed(&self) -> bool {
matches!(self, Self::Managed)
}
}
impl PythonPreference {
fn allows(self, source: PythonSource) -> bool {
// If not dealing with a system interpreter source, we don't care about the preference