-
Notifications
You must be signed in to change notification settings - Fork 739
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
Support custom virtual environment directory names #1422
Comments
I wonder why any hardcoding names are needed. Why not checking on the presence of "pyvenv.cfg" + "bin" / "lib"-folders? Why would this need to be different?
|
@woutervh We don't want to scan every directory in your current directory on every invocation, so we use a heuristic. |
how are you supposed to install a package when using a non-standard venv-name?
|
That is a small performance-hit i'm very happy to endure, the python-executable in a virtualenv is symlink to a global python, I would love to see a uv-symlink in the venv's bin/ that only operates on the venv.
|
pyenv-virtualenv solves this by identifying the env to be used in a folder in a |
from #1495 (comment) I have a solution for my use-case: symlink the foo-folder to a .venv-subfolder
@jkomalley this solves your use-case?
|
Yes, that does work for my use case. Thanks! I still think adding "venv/" to the venv search makes sense since (IMO) it's just as common as ".venv/", and both are listed as conventions in the venv documentation. The default one uv creates can be ".venv", but both should be expected by default since both are so common. I think an option for venvs with other "non-default" names is to specify them in the pyproject.toml like this: [tool.uv]
venvs = ["env1", "env2"] Or, since multiple venvs potentially means different dependencies or python versions for each, maybe something like this: [tool.uv.venvs.env1]
python="3.12"
deps=[
"env1_dep1",
"env1_dep2"
]
[tool.uv.venvs.env2]
python="3.10"
deps=[
"env2_dep1",
"env2_dep2"
] For either, uv could then add "env1" and "env2" to the venv directory search. When you make a new venv like And when you run |
Unfortunately, I find myself in the situation to support windows-users. |
@woutervh I think you should be able to use a junction |
When running
In this case, being able to configure the name to use somewhere would be very helpful. Any of CLI parameters, pyproject.toml, envvar, etc would work for my use case. |
This was sort of accomplished in #6834, though it can't be customized outside of projects and the |
It is common for virtual environment directories to be either .venv/ or venv/, but only .venv/ is currently supported in without needing to activate the environment. Since both are common names for virtual environments, could both be supported by default in uv? And/Or could there potentially be a config/environment variable that holds a user defined default virtual environment directory name that gets checked along with .venv/VIRTUAL_ENV/CONDA_PREFIX?
The text was updated successfully, but these errors were encountered: