uv icon indicating copy to clipboard operation
uv copied to clipboard

Warn if not in a virtual environment and `.venv` is present in the working directory

Open zanieb opened this issue 1 year ago • 3 comments

e.g. to help guard against common mistakes

zanieb avatar Feb 16 '24 01:02 zanieb

FWIW, py (the Python launcher for Unix) automatically uses .venv if found without requiring it to be activated.

henryiii avatar Feb 16 '24 22:02 henryiii

We also do the same if it's in the current directory (I'm 90% sure)

zanieb avatar Feb 16 '24 22:02 zanieb

We also do the same if it's in the current directory (I'm 90% sure)

In my testing this is correct. I have not used Python launcher so I could be wrong but I think the difference will come when running the program if no virtual environment is active. py something.py works but python something.py fails even though the packages were installed into the virtual environment by uv since it isn’t active.

sanders41 avatar Feb 17 '24 09:02 sanders41

We want to improve the handling of venvs, but rather by improving uv to make these more convenient than by showing a warning when it's possible to have workflows that don't require activating the venv (https://github.com/astral-sh/uv/pull/1505#issuecomment-1968506663)

konstin avatar Feb 28 '24 08:02 konstin