Skip to content

Pin workspace Python interpreter to project .venv#244

Open
MrJarnould wants to merge 2 commits into
timlaing:mainfrom
MrJarnould:chore/pin-workspace-python-interpreter
Open

Pin workspace Python interpreter to project .venv#244
MrJarnould wants to merge 2 commits into
timlaing:mainfrom
MrJarnould:chore/pin-workspace-python-interpreter

Conversation

@MrJarnould
Copy link
Copy Markdown

@MrJarnould MrJarnould commented May 15, 2026

Proposed change

Adds "python.defaultInterpreterPath": "\${workspaceFolder}/.venv/bin/python" to .vscode/settings.json so the VS Code Python extension consistently resolves this workspace's interpreter on reload.

Without an explicit workspace-level pin, the picker selection is transient and the extension can fall back to a user-level python.defaultInterpreterPath that points at an unrelated project's venv. Combined with the existing "python.terminal.activateEnvInCurrentTerminal": true, that causes integrated terminals to silently activate the wrong venv on window reload, which makes uv pip install and type checkers (e.g. Pyrefly) target the wrong site-packages.

The setting follows the common Python convention of a .venv/ at the repo root. Contributors using a different venv location can override locally via the interpreter picker. A JSONC comment above the line documents the Windows equivalent path (per CodeRabbit feedback already addressed).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New service (thank you!)
  • New feature (which adds functionality to an existing service)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation or code sample

Additional information

  • This PR fixes or closes issue: N/A
  • This PR is related to issue: N/A

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works. (Workspace config; no test surface.)

🤖 Generated with Claude Code

Add `python.defaultInterpreterPath` set to `${workspaceFolder}/.venv/bin/python`
so the VS Code Python extension consistently resolves this workspace's
interpreter on reload, rather than falling back to a user-level default that
may point at an unrelated project's venv.

Why: without an explicit workspace-level pin, the picker selection is
transient and the Python extension can re-activate the wrong interpreter
in integrated terminals on window reload, which causes `uv pip install` and
type checkers (e.g. Pyrefly) to silently target the wrong site-packages.

This mirrors the common Python project convention of a `.venv/` directory
at the repo root. Contributors using a different venv location can override
locally via the interpreter picker.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

VS Code workspace settings are updated to explicitly configure the Python interpreter path. A python.defaultInterpreterPath entry is added, pointing to the workspace's .venv/bin/python file, working alongside the existing python.languageServer setting.

Changes

Workspace Configuration

Layer / File(s) Summary
Python interpreter path configuration
.vscode/settings.json
python.defaultInterpreterPath is added and configured to use the workspace virtual environment at ${workspaceFolder}/.venv/bin/python.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tiny change, quite spry and neat,
The Python path now smells sweet!
From .venv the interpreter springs,
VS Code now knows all dev things. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: pinning the workspace Python interpreter to the project .venv directory in VS Code settings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly relates to the changeset, providing detailed context for adding python.defaultInterpreterPath to .vscode/settings.json.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.vscode/settings.json:
- Line 32: The workspace setting "python.defaultInterpreterPath" currently
points to the Unix-style path ".venv/bin/python" which fails on Windows; update
the project guidance by adding a short note in the repository README (or a new
.vscode/README) that documents the Windows equivalent
".venv\\Scripts\\python.exe" and instructs Windows contributors to create a
local override (or a platform-specific workspace settings file) pointing
"python.defaultInterpreterPath" to that path so their VS Code picks the correct
interpreter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9f0f05b5-9961-4a90-a3c7-6a468ba535ae

📥 Commits

Reviewing files that changed from the base of the PR and between 29315db and 9fab498.

📒 Files selected for processing (1)
  • .vscode/settings.json

Comment thread .vscode/settings.json
Address CodeRabbit feedback on the workspace interpreter pin: the path
`${workspaceFolder}/.venv/bin/python` is Unix-only and won't resolve on
Windows. Add a JSONC comment above the setting documenting the Windows
equivalent (`${workspaceFolder}/.venv/Scripts/python.exe`) so contributors
on that platform know to override locally via User Settings or the
interpreter picker.

`.vscode/settings.json` is officially JSONC, so the `//` comment is valid.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant