Detect if project directory was moved for venv reconstruction
#10,895 opened on Jan 23, 2025
Description
Summary
I just had an issue with pytest á la #7260. Turned out that because I had moved the project directory, the shebang in the "pytest" script in the venv was wrong, and apparently this meant that the command would fallthrough to the system-installed pytest which couldn't find my project or any of its dependencies, of course. uv sync would not detect this, but deleting .venv did the trick.
So I thought, since the location of the venv is hardcoded in the entrypoint scripts, it would be appropriate for uv to keep track of whether the venv location has changed. For example, it could go into the pyvenv.cfg file under a uv-venv-path variable or such. Then, if the actual path of the venv does not match this value, it would indicate to uv that the venv (or at least the entrypoints) should be reconstructed.
Example
No response