Repository navigation
VIRTUAL_ENV_PROMPT is not respected by extension #22956
Copy link
Copy link
Closed
Labels
author-verification-requestedIssues potentially verifiable by issue authorIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugexperimentingFeature is part of an experimentFeature is part of an experimentneeds PRReady to be worked onReady to be worked onverifiedVerification succeededVerification succeeded
Milestone
Description
Type: Bug
Using the latest prerelease of python to fix virtualenv activation being entirely broken:
Behaviour
Expected vs. Actual
VSCode terminals spawn with part of path (.venv) prepending prompt regardless of VIRTUAL_ENV_PROMPT. Example below with oh-my-zsh, agnoster theme. Worked correctly prior to 2024/02/22.
Using prerelease extension version as automatic virutalenv activation stopped working entirely without it today.
(.venv) tkern@dc7-sim-h06-218 /home/scratch.tkern_inf/testgen_otel/otel_pypl_bridge ↰ main ± deactivate
tkern@dc7-sim-h06-218 /home/scratch.tkern_inf/testgen_otel/otel_pypl_bridge ↰ main ± source .venv/bin/activate
(otel-pypl-bridge-py3.9) tkern@dc7-sim-h06-218 /home/scratch.tkern_inf/testgen_otel/otel_pypl_bridge ↰ main ± code .venv/bin/activate
Prompt should have been (otel-pypl-bridge-py3.9)
Steps to reproduce:
- Create a virtualenv using e.g. poetry, which will set VIRTUAL_ENV_PROMPT to something non-standard based on pyproject.toml info
- Set as default virtual environment in a workspace
- Open a new terminal - the name will be taken from the path to the virtualenv instead
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.17
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
- Value of the
python.languageServersetting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2024-02-22 15:25:32.370 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-02-22 15:25:32.370 [info] Experiment 'pythonREPLSmartSend' is active
2024-02-22 15:25:32.370 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-02-22 15:25:32.370 [info] Experiment 'pythonTestAdapter' is active
2024-02-22 15:25:32.370 [info] Default formatter is set to ms-python.black-formatter for workspace /home/scratch.tkern_inf/testgen_otel/otel_pypl_bridge
2024-02-22 15:25:32.370 [info] Test server listening.
2024-02-22 15:25:32.371 [info] Python interpreter path: ./.venv/bin/python
2024-02-22 15:25:33.330 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.1.10531008/pythonFiles/printEnvVariables.py
2024-02-22 15:25:33.330 [info] shell: zsh
2024-02-22 15:25:33.433 [info] > /home/utils/Python/builds/3.9.16-20230503/bin/python ~/.vscode-server/extensions/ms-python.python-2024.1.10531008/pythonFiles/printEnvVariables.py
2024-02-22 15:25:33.433 [info] shell: zsh
2024-02-22 15:25:33.523 [info] Send text to terminal: /home/utils/Python/builds/3.9.16-20230503/bin/python /home/tkern/.vscode-server/extensions/ms-python.python-2024.1.10531008/pythonFiles/printEnvVariablesToFile.py /home/tkern/.vscode-server/extensions/ms-python.python-2024.1.10531008/pythonFiles/deactivate/zsh/envVars.txt
2024-02-22 15:25:34.353 [info] Starting Pylance language server.
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Extension version: 2024.0.1
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Remote OS version: Linux x64 5.4.152-4.x86_64
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30887150
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
7j2b6412:30969109
bg6jg535:30958357
Reacted by Segev Finer
Metadata
Metadata
Assignees
Labels
author-verification-requestedIssues potentially verifiable by issue authorIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugexperimentingFeature is part of an experimentFeature is part of an experimentneeds PRReady to be worked onReady to be worked onverifiedVerification succeededVerification succeeded
Activity
karrtikr commentedon Feb 27, 2024
Please provide the debug logs which can help diagnose the issue:
Developer: Set log levelcommandTraceDeveloper: Reload WindowcommandOutput for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)VIRTUALENV_ENV_PROMPTis, where it is set, and the contents of your./venv/bin/activatescript?[-]VIRTUALENV_ENV_PROMPT is not respected by extension[/-][+]VIRTUAL_ENV_PROMPT is not respected by extension[/+]Arnatious commentedon Mar 4, 2024
Typo on my part when making the issue - edited and fixed - the actual variable is VIRTUAL_ENV_PROMPT
Trace level output:
.venv/bin/activate content
Arnatious commentedon Mar 4, 2024
We can see from the logs that the addon does seem to identify
VIRTUAL_ENV_PROMPTcorrectly, but for some reason it goes ahead and prepends(.venv)insteadRespect `VIRTUAL_ENV_PROMPT` when calculating PS1 (#23080)
karrtikr commentedon Mar 18, 2024
Fix should be out in the pre-release version of the extensio, use the following to try it out:
karrtikr commentedon Mar 22, 2024
Ted Kern (@Arnatious) Let us know if you can verify it is fixed.
Respect `VIRTUAL_ENV_PROMPT` when calculating PS1 (microsoft/vscode-p…
Respect `VIRTUAL_ENV_PROMPT` when calculating PS1 (microsoft/vscode-p…