Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Respect VIRTUAL_ENV env var when running uv venv without an arg #1722

Closed
dwreeves opened this issue Feb 19, 2024 · 3 comments
Labels
enhancement New feature or improvement to existing functionality

Comments

@dwreeves
Copy link
Contributor

dwreeves commented Feb 19, 2024

Running uv venv does not respect the VIRTUAL_ENV env var, even though it feels like it should.

Example

$ mkdir testproject && cd testproject
$ uv --version
uv 0.1.5
$ VIRTUAL_ENV=customvenv uv venv --verbose
 uv_interpreter::python_query::find_default_python platform=Platform { os: Macos { major: 14, minor: 1 }, arch: X86_64 }, cache=Cache { root: "~/Library/Caches/uv", refresh: None, _temp_dir_drop: None }
      0.004652s   2ms DEBUG uv_interpreter::interpreter Using cached markers for: ~/.pyenv/versions/3.12.0/bin/python3.12
Using Python 3.12.0 interpreter at ~/.pyenv/versions/3.12.0/bin/python3.12
Creating virtualenv at: .venv

With the above, I expected that it would create a venv at customvenv, not at .venv.

@dwreeves dwreeves changed the title Respect VIRTUAL_ENV env var when running uv venv without an arg [Feature request] Respect VIRTUAL_ENV env var when running uv venv without an arg Feb 19, 2024
@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Hm we generally use a VIRTUAL_ENV path to find the Python interpreter to use. It seems like it'd be pretty surprising to use it for a name here?

Related:

@zanieb zanieb added the enhancement New feature or improvement to existing functionality label Feb 19, 2024
@dwreeves
Copy link
Contributor Author

Sounds good.

I'm not sure that this is surprising behavior per se, as setting the VIRTUAL_ENV variable shows intent to use it for the purposes of a venv. (I ran into this when trying to rely on VIRTUAL_ENV to do uv venv && uv pip install.)

That said, VIRTUAL_ENV is a bit of a hack, and this isn't a big deal in any event.

Want me to close this issue?

@zanieb
Copy link
Member

zanieb commented Feb 20, 2024

Yeah I'd say VIRTUAL_ENV is actually intended to use an existing environment elsewhere on the system.

Thanks for the feedback though. Hopefully we can tackle this more holistically.

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants