Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/uv-python/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,22 @@ impl PythonRequest {
if let Ok(request) = PythonDownloadRequest::from_str(value) {
return Self::Key(request);
}
// Check if the value is current active pyenv virtualenv
// It mean that name is end of path provided by PYENV_VIRTUAL_ENV variable
if let Some(pyenv_virtual_env) = std::env::var_os("PYENV_VIRTUAL_ENV") {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pyenv sets both PYENV_VIRTUAL_ENV and VIRTUAL_ENV to the same value. Maybe should here VIRTUAL_ENV?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We already read VIRTUAL_ENV — is it not working for you?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. It do not work.

if let Some(pyenv_virtual_env) = pyenv_virtual_env.to_str() {
if value
== Path::new(pyenv_virtual_env)
.file_name()
.unwrap()
.to_str()
.unwrap()
{
return Self::Directory(PathBuf::from(pyenv_virtual_env));
}
}
}

// Finally, we'll treat it as the name of an executable (i.e. in the search PATH)
// e.g. foo.exe
Self::ExecutableName(value.to_string())
Expand Down