Closed zmanji closed 1 month ago
I'm going to use --site-packages-copies
to stay ~consistent with pex --venv-site-packages-copies ...
used for venvs internal to the PEX_ROOT, the difference being those try to hard link 1st and fall back to copy, whereas these external venvs will just copy.
Once this is fixed, pex will be a pretty ideal tool for managing dev venvs.
Ok, the --site-packages-copies
option is now available in the Pex 2.12.0 release.
Peeled out of https://github.com/pantsbuild/pex/issues/2312#issuecomment-1871722718
Thinking about it an external venv should copy files from the wheel cache instead of hardlinks / symlinks.
In my case I use pex to create venvs for tools like VSCode. I could choose to edit a file in a venv for debugging purposes and if I do, I inadvertently corrupt the wheel cache.
Example:
Then remove the first line (
import re
) ofThen the venv is broken when I run:
Even if I delete the venv and recreate it it still suffers from the same problem
The only way to fix this is to delete the pex wheel cache.
A way to fix this is to overload the existing
--copies
flag to also copy files from the wheel cache or to introduce another flag to signal this and change this function https://github.com/pantsbuild/pex/blob/4eb5c9aa25c6a695bf55263ab239189b720cebaf/pex/pep_376.py#L350-L404to do copies instead of links.