posit-dev / posit-dev/positron
Should the Python subshell activate the venv?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
Today, the underlying shell in the Console (using the ! symbol) seems to have no notion of the virtual environment it should be running in. For example:
Python 3.13.3 (Uv: .venv) started.
Python 3.13.3 (main, May 17 2025, 13:30:59) [Clang 20.1.4 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.
Automatic import reloading for Python is enabled. It can be disabled with the [python.enableAutoReload setting](vscode-file://vscode-app/Users/austin/repos/positron/out/vs/code/electron-sandbox/workbench/workbench-dev.html#).
>>> !which python
9.43s - pydevd: Sending message related to process being replaced timed-out after 5 seconds
/Users/austin/.pyenv/shims/python
>>> !python -V
24.14s - pydevd: Sending message related to process being replaced timed-out after 5 seconds
pyenv: python: command not found
The `python' command exists in these Python versions:
3.12.9
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
Should these subshells run source /path/to/bin/activate before executing these commands, similar to what a new Terminal does?
As I noted in https://github.com/posit-dev/positron/issues/8174#issuecomment-2984394575, this would enable using !pip install if for some reason someone wanted to do that instead of pip install or %pip install etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the Console executes commands entered with ! and how it receives the selected Python environment. Reproduce the issue with !which python and !python -V; done means those commands use the active virtual environment, similarly to a new Terminal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100