Skip to content

Audit and potentially deprecate defaultInterpreterPath updates when Python Environments extension is active #25735

Open

Description

Summary

The Python extension currently updates the python.defaultInterpreterPath setting in multiple places throughout the codebase. When the Python Environments extension is installed and active (python.useEnvironmentsExtension: true), this creates potential conflicts and unexpected behavior since the Python Environments extension is intended to manage interpreter/environment selection independently.

Current Code Paths That Update defaultInterpreterPath

Code Path File Purpose
InterpreterPathService.update() src/client/common/interpreterPathService.ts#L107 Central method for updating the setting
deprecatedProposedApi.setActiveEnvironment() src/client/deprecatedProposedApi.ts#L135 API for other extensions to set the active environment
environmentApi.updateActiveEnvironmentPath() src/client/environmentApi.ts#L280 Public API for extensions
VirtualEnvironmentPrompt src/client/interpreter/virtualEnvs/virtualEnvPrompt.ts#L78 Prompts user when a new virtual environment is detected
ActivatedEnvironmentLaunch src/client/interpreter/virtualEnvs/activatedEnvLaunch.ts#L119 Auto-selects interpreter when VS Code is launched from an activated environment
createEnvApi src/client/pythonEnvironments/creation/createEnvApi.ts#L123 Updates path after "Create Environment" command

None of these code paths are currently guarded by useEnvExtension() to check if the Python Environments extension is active.

Deprecation Considerations

If we disable these updates when the Python Environments extension is active, defaultInterpreterPath would no longer be updated by the Python extension in the following scenarios (as these are the situations where it is updated for now)

  1. VirtualEnvironmentPrompt: When a new virtual environment is detected in the workspace
  2. ActivatedEnvironmentLaunch: When VS Code is launched from a terminal with an activated conda/venv environment
  3. Create Environment command: After using the "Create Environment" command
  4. Extension APIs: When other extensions call updateActiveEnvironmentPath() or setActiveEnvironment()

Further investigation is needed to understand the full impact on prompting behavior and auto-selection.

Questions

  1. Do we want the Python extension to be able to edit defaultInterpreterPath when the Python Environments extension is active?
  2. Does the Python Environments extension handle all the scenarios listed above?

Activity

  1. eleanorjboyd commented on Jan 14, 2026

    @eleanorjboyd
    MemberAuthor

    This was generated by AI- but the primary question is

    Do we want the Python extension (or envs ext) to be able to edit defaultInterpreterPath? Should the extension ever touch or update that setting?

    my feeling is no because that is a fallback setting people can use but the better way is now the envs ext

    Karthik Nadig (@karthiknadig) Anthony Kim (@anthonykim1) would appreciate you input on this basic question here (and you can read above for more context)

  2. added
    area-environmentsFeatures relating to handling interpreter environments
    needs spikeLabel for issues that need investigation before they can be worked on.
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 14, 2026
  3. karthiknadig commented on Jan 14, 2026

    @karthiknadig
    Member

    It should not, with a caveat. What should happen when user changes the environment? Should it update or not?

    The problem here was that it was changing without user asking to change it.

    Another thing. When envs extension is installed, python extension should not have control of this setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsneeds spikeLabel for issues that need investigation before they can be worked on.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions