Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interpreter cache collisions for relative virtualenv paths (#3823)
Closes #3784 The cache did not use an absolute path. I'm not sure this is actually a new bug, as this code wasn't touched in #3266 but perhaps there was a slight difference in the paths we were passing around. Note, just canonicalizing the path as soon as we see it doesn't work because then we jump out of the virtual environmnent into the system interpreter. ## Test plan ``` ❯ uv venv Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12 Creating virtualenv at: .venv Activate with: source .venv/bin/activate ❯ uv pip install anyio Resolved 3 packages in 81ms Installed 3 packages in 4ms + anyio==4.3.0 + idna==3.7 + sniffio==1.3.1 ❯ mkdir uv-issue-3784 && cd uv-issue-3784 ❯ uv venv Using Python 3.12.3 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12 Creating virtualenv at: .venv Activate with: source .venv/bin/activate ❯ gcm Switched to branch 'main' Your branch is up to date with 'origin/main'. ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd uv-issue-3784 ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at /Users/zb/workspace/uv/.venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd .. ❯ gco zb/fix-relative-venv Switched to branch 'zb/fix-relative-venv' ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 Package Version ------- ------- anyio 4.3.0 idna 3.7 sniffio 1.3.1 ❯ cd uv-issue-3784 ❯ cargo run -q -- pip list -v -p .venv DEBUG Checking for Python interpreter in directory `.venv` TRACE Cached interpreter info for Python 3.12.3, skipping probing: .venv/bin/python3 DEBUG Using Python 3.12.3 environment at .venv/bin/python3 ```
- Loading branch information