<#17727 Override virtualenv prompt when exporting ...
# github-notifications
q
#17727 Override virtualenv prompt when exporting using symlinks Issue created by danxmoran Is your feature request related to a problem? Please describe. When you export a Python virtualenv using symlinks:
Copy code
./pants export --resolve=<resolve> --symlink-python-virtualenv
You end up with a link at
./dist/export/python/virtualenvs/<resolve>/<python-version>
pointing into Pants' named caches. The linked dir has a sha for a name. When you activate the virtualenv, your prompt then changes to be the sha-name of the cache dir, instead of the link:
Copy code
$ source ./dist/export/python/virtualenvs/<resolve>/<python-version>/bin/activate
# Prompt changes to:
(0796ea8d0cb05fb74572064697475fd9cfdfa756) $
This takes up a ton of real estate in the console, and is confusing if you don't know how everything links up under-the-hood. Describe the solution you'd like
python -m venv
supports a
--prompt
option to set the
PS1
generated for a venv, overriding the default of using the venv's
basename
. It looks like pex's
venv
command already has the same option. It'd be nice if the export logic plumbed through the resolve name (maybe configurable via option?) to the process that generates the virtualenv in the cache dir. Describe alternatives you've considered We could disable the default virtualenv prompt and roll our own prompt generation via wrapper script, but we're trying to get away from needing so many wrappers now that we're adopting Pants. pantsbuild/pants