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

mkdocs project and python.terminal.activateEnvironment #22247

Closed
normanlorrain opened this issue Oct 17, 2023 Discussed in #22237 · 8 comments
Closed

mkdocs project and python.terminal.activateEnvironment #22247

normanlorrain opened this issue Oct 17, 2023 Discussed in #22237 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@normanlorrain
Copy link

Discussed in #22237

Originally posted by normanlorrain October 16, 2023
I have a workspace with a .venv/ containing Python 3.11 and the mkdocs library for building my web site.

I'd like the environment to be activated when I open a terminal (Powershell, Windows 10) to run mkdocs. It's not activating. I can activate it manually but it would be nice to have it automatic as I think is the intention.

The only enabled extention is Python & Pylance.

python.terminal.activateEnvironment: true

I don't see any errors in the Python extension output.

Edit: by the way, this used to work, a month or so ago.

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 17, 2023
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Oct 18, 2023
@karrtikr
Copy link

You might've noticed a notification similar to:

image

Try running the following command in terminal:

python -c"import sys;print(sys.executable)

You might notice that virtual environment is actually activated even though you might not see it in the terminal prompt indicator (.venv).

@karrtikr
Copy link

If that's still not activating, please provide the debug logs which can help diagnose the issue:

  • Run Developer: Set log level command
  • Select Trace
  • Run Developer: Reload Window command
  • Provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 18, 2023
@normanlorrain
Copy link
Author

python -c"import sys;print(sys.executable)"

OK, I see it now. The environment is activated properly even if the command line prompt doesn't indicate it. I may have seen the notification at some point, but can't remember :) .

Has the status bar indication been dropped? It's still in the documentation
image

Also, how does it deal with multiple environments? I sometimes like to be able to switch between environments to test with different Python versions. The Create Environment command only seems to allow one environment. FWIW I can still do it manually, I see.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 20, 2023
@normanlorrain
Copy link
Author

In my use case it's a "Python" project but the the files I'm editing aren't Python. The status bar only indicates the environment when a .py file is open in the editor. I can create an empty file for that purpose but that seems silly.

It would be nice if the status bar showed the extension activation status separate from the file Language Mode. i.e. I'm in a Python project and editing the Readme file, and I open a terminal window to run some example I want to paste in the readme.

@karrtikr
Copy link

Thanks for getting back.

I sometimes like to be able to switch between environments to test with different Python versions. The Create Environment command only seems to allow one environment. FWIW I can still do it manually, I see.

The doc you pointed out explains Python: Select Interpreter command using which it can be done.

It would be nice if the status bar showed the extension activation status separate from the file Language Mode. i.e. I'm in a Python project and editing the Readme file, and I open a terminal window to run some example I want to paste in the readme.

The following setting might just be for you:

image

Let me know if we can do anything else, or any feedback regarding making the notification clearer.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 21, 2023
@karrtikr
Copy link

karrtikr commented Oct 21, 2023

I've changed the notification to:

image

to make it more concise so folks don't miss it.

@normanlorrain
Copy link
Author

It works now. For anyone reading this in the future, interpreter.infoVisibility is only available at User/Machine level. Maybe "always" should be the default ("explicit is better than implicit").

Thanks for the help; I jump in and out of using these tools (not a daily user) so have missed some of the progress and changes. I'll try to follow the project more closely. Removing the indication from the terminal prompt was probably done for a good reason, I'll humbly try to research that.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 21, 2023
@karrtikr
Copy link

Great, happy to be of help.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants