Make :PymodeRun execute with the activated virtualenv interpreter#1200
Draft
Copilot wants to merge 5 commits into
Draft
Make :PymodeRun execute with the activated virtualenv interpreter#1200Copilot wants to merge 5 commits into
:PymodeRun execute with the activated virtualenv interpreter#1200Copilot wants to merge 5 commits into
Conversation
🧪 Test Results SummaryThis comment will be updated automatically as tests complete. Python linux-3.10 ✅
Python linux-3.11 ✅
Python linux-3.12 ✅
Python linux-3.13 ✅
Python linux-3.14 ✅
Python macos-3.10 ✅
Python macos-3.11 ✅
Python macos-3.12 ✅
Python macos-3.13 ✅
Python windows-3.10 ✅
Python windows-3.11 ✅
Python windows-3.12 ✅
Python windows-3.13 ✅
📊 Overall Summary
🎉 All tests passed across all Python versions! Generated automatically by CI/CD workflow |
Agent-Logs-Url: https://github.com/python-mode/python-mode/sessions/990a6238-68c1-475c-b384-5afbd8f07a7f Co-authored-by: diraol <192702+diraol@users.noreply.github.com>
Agent-Logs-Url: https://github.com/python-mode/python-mode/sessions/990a6238-68c1-475c-b384-5afbd8f07a7f Co-authored-by: diraol <192702+diraol@users.noreply.github.com>
Agent-Logs-Url: https://github.com/python-mode/python-mode/sessions/990a6238-68c1-475c-b384-5afbd8f07a7f Co-authored-by: diraol <192702+diraol@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix virtual environment activation issue in Pymode
Make Apr 21, 2026
:PymodeRun execute with the activated virtualenv interpreter
- Set __file__ correctly in subprocess so user code referencing it sees the real source path instead of a temp file path - Rewrite temp file paths in subprocess tracebacks to the real source file - Add explicit UTF-8 encoding to subprocess Popen call - Add g:pymode_run_timeout support with TimeoutExpired handling to prevent Vim from hanging on non-terminating scripts - Restore sys.stdout/sys.stderr before returning on SystemExit with non-false exit code (pre-existing leak) - Fix test: use fnameescape() instead of string() for PymodeVirtualenv argument (string() wraps in quotes, producing a malformed path) - Save and restore g:pymode_virtualenv_enabled/g:pymode_virtualenv in the test to avoid polluting subsequent tests - Remove misleading Assert 1 "skip" patterns; drop unreachable else branches so cleanup runs unconditionally Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
`Pymode` correctly detected/activated virtualenvs, but `:PymodeRun` still executed code with Vim's embedded/system Python, causing version mismatch (e.g. active 3.13 venv, output from 3.14 system Python).
This change aligns run behavior with virtualenv activation so executed code uses the selected environment interpreter.
Run-path correction for virtualenv-enabled sessions
Correctness fixes
Regression coverage
Docs update
```python
before: often printed system interpreter from Vim host runtime
import sys
print(sys.executable)
after: with :PymodeVirtualenv .venv, prints .../.venv/bin/python (or Scripts/python.exe)
```