Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test notification system for setting up deactivate command #22288

Closed
12 tasks done
karrtikr opened this issue Oct 23, 2023 · 4 comments
Closed
12 tasks done

Test notification system for setting up deactivate command #22288

karrtikr opened this issue Oct 23, 2023 · 4 comments

Comments

@karrtikr
Copy link

karrtikr commented Oct 23, 2023

Refs: #22121

Complexity: 5

Create Issue


Requirements

  • Python extension pre-release & VS Code Insiders
  • Basic terminal shell types, please install if necessary and tick once tested:
    • Windows:
      • cmd
      • powershell
      • powershellcore
    • Linux (our codespaces already have these installed):
      • bash
      • zsh
      • fish
    • macOS :
      • bash
      • zsh
      • powershellcore

Background

Traditionally, activation script (<venv>/<bin>/activate) was run to activate terminals, which registered the deactivate command as well. But now that we're using environment variables to activate terminals instead, deactivate command is broken as it never gets registered.

To make it work, this we added a notification system which helps user register the "deactivate" command in their shell init script.

Verification

  • Add following to user settings and reload window:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
  • Open a workspace folder and activate Python extension by opening a Python file.

  • Use Create environment command to select a venv

  • Loop -> Do the following for all terminal shell types:

    • Open a new terminal.
    • Make sure terminal is activated using the selected environment. Run the following in terminal:
      python -c"import sys;print(sys.executable)"
      
    • Output should contain the path to interpreter selected. For eg. for .venv it looks something like:
      C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\crap\.venv\Scripts\python.exe
      
    • Run "deactivate" command in terminal, a similar notification should show up:
      image
    • Verify clicking "learn more" points to appropriate wiki.
    • After following through with the notification, ensure deactivate command works:
      image
    • Change the default shell in your OS using Terminal: Select Default Profile, say bash->fish
@aiday-mar
Copy link

aiday-mar commented Oct 24, 2023

I was following the steps but I am not able to deactivate the env with deactivate in bash. I opened an issue about it. I think I may be not following the steps correctly?

@sbatten
Copy link
Member

sbatten commented Oct 24, 2023

it all worked for me, fwiw I totally missed the "Tip" in the linked document so I was a bit confused about the file script being populated automatically.

@karthiknadig karthiknadig added this to the October 2023 milestone Oct 24, 2023
@karrtikr
Copy link
Author

@aiday-mar, Not to worry, this is expected for bash on newer macOS. But it should work for zsh or powershellCore, if not please open an issue regarding the same.

@karrtikr
Copy link
Author

karrtikr commented Oct 24, 2023

@sbatten Thanks! Maybe I should not quote (> ...) that? I was trying to follow what VS Code docs generally does for tips. Feel free to edit the Wiki link.

@aiday-mar aiday-mar removed their assignment Oct 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants