Repository navigation
feat: terminals can activate a Python environment, including conda - #186
Merged
Merged
Conversation
Add VS Code-style Python environment activation for integrated terminals. "Activate Python environment in terminals" (off by default) types the activation command into new and restarted shells. "Python interpreter path" mirrors python.defaultInterpreterPath: empty finds a .venv or venv in the terminal's cwd; otherwise an interpreter or environment folder, with conda environments activated through `conda activate`. Both settings are project-scoped, and the path is also file-backed, so a repository can set "pythonInterpreterPath" in t3.json. Exposed in web, desktop and mobile settings and the MCP environment preferences tools. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
T3 Code terminals open without the project's Python environment, so every new terminal needs a manual
source .venv/bin/activate(orconda activate). VS Code handles this withpython.terminal.activateEnvironmentandpython.defaultInterpreterPath.What changed
PATHdirectly, means it runs after the user's rc files, which often rebuildPATH. Supported shells: bash, zsh, sh, fish, csh, PowerShell and cmd.python.defaultInterpreterPath. When empty, the terminal uses the.venvorvenvin its working directory. Otherwise it takes an interpreter or environment folder (.venv/bin/python,~/miniconda3/envs/app);~is expanded and relative paths start at the terminal's cwd. A folder withconda-metais activated withconda activate <env>, which needsconda init. Anything else uses its own activate script."pythonInterpreterPath"). The order is project override, then environment, then the checkout's t3.json, then auto-detect. The on/off switch is deliberately not readable from t3.json, so a cloned repo can't opt anyone into running commands.t3_environment_*preference tools. The terminal user guide anddocs/fork-differences.mdare updated.Code:
apps/server/src/terminal/pythonEnvironment.tsbuilds the activation command, andresolveTerminalPythonEnvironment/startSessioninapps/server/src/terminal/Manager.tsapply it.Testing
pythonEnvironment.test.tscovers per-shell commands and quoting,.venvovervenv, configured venv and conda paths, and a missing path.Manager.test.tscovers activation being written only when enabled, and the order between settings and t3.json.Done by Claude Opus 5.5 in Claude Code (via T3 Code).
🤖 Generated with Claude Code