uv
uv copied to clipboard
Warn if not in a virtual environment and `.venv` is present in the working directory
e.g. to help guard against common mistakes
FWIW, py (the Python launcher for Unix) automatically uses .venv if found without requiring it to be activated.
We also do the same if it's in the current directory (I'm 90% sure)
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.
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)