classification
Title: venv --prompt argument is ignored
Type: Stage:
Components: Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: andream, vinay.sajip, xtreak
Priority: normal Keywords:

Created on 2020-02-07 09:08 by andream, last changed 2020-02-11 05:21 by vinay.sajip.

Messages (4)
msg361548 - (view) Author: Andrea (andream) Date: 2020-02-07 09:08
In creating a new virtual environment, the help suggest a --prompt argument to specify a different name by the time the environment is active.

https://docs.python.org/3/library/venv.html

The argument is apparently ignored as the folder name always appears instead to whatever is specified in the prompt.
Checking at the config file content there nothing written inside, thought I'm not sure this should be the case.
msg361553 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-07 09:47
Can you please add a reproducer of the steps along with the operating system and python version? The --prompt was modified in 3.9 to accept "." so that the current folder name is used in issue38901.

# Use custom name as testing for the prompt

➜  cpython git:(master) ./python.exe -m venv foo-venv --prompt testing
➜  cpython git:(master) ✗ source foo-venv/bin/activate
(testing) ➜  cpython git:(master) ✗ deactivate

# Delete to recreate with prompt as . so that basename is used

➜  cpython git:(master) ✗ rm -rf foo-venv
➜  cpython git:(master) ./python.exe -m venv foo-venv --prompt .
➜  cpython git:(master) ✗ source foo-venv/bin/activate
(cpython) ➜  cpython git:(master) ✗
msg361766 - (view) Author: Andrea (andream) Date: 2020-02-11 00:46
Operative system is OS X 10.15.3 (19D76) Catalina
Python 3.7.4 installed via HomeBrew

If I do this python -m venv ciao --prompt NewOne by the time I activate the environment, the prompt looks like (ciao) andreamoro@MacBookAir:~/Python

Am I misunderstanding the behaviour of the prompt argument?

Thanks
Andrea
msg361781 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2020-02-11 05:21
> Am I misunderstanding the behaviour of the prompt argument?

You can see from Karthikeyan's post how it's supposed to work, and how it does work in his example. It may be that something else is overwriting the prompt in your environment - we can't tell without knowing what's in your .bashrc, .profile etc.
History
Date User Action Args
2020-02-11 05:21:51vinay.sajipsetmessages: + msg361781
2020-02-11 00:46:32andreamsetmessages: + msg361766
2020-02-07 09:47:49xtreaksetnosy: + vinay.sajip, xtreak
messages: + msg361553
2020-02-07 09:08:45andreamcreate