Skip to content

Create environments automatically (or via UI command) #229

Closed

Description

@grst

When selecting hatch environment that exists in the env matrix, but hasn't been created yet via "Select Interpreter" in vscode, nothing happens.

IMO there should be either
(1) a prompt "This env does not exist, do you want to create it now?", or
(2) an error message "This env does not exist, please create it using ..."

where ... should be a command from the command palette.

Activity

  1. flying-sheep commented on Jul 6, 2026

    @flying-sheep
    Member

    I had trouble parsing that sentence. You mean this right?

    When using the Select Interpreter command in VS Code to select a Hatch environment that hasn't been created yet, nothing happens.

    If so, yeah, that’s certainly a gotcha. If I understood the vscode-python-environments people correctly, the Select Interpreter command interacts with the legacy “global environment”, while selecting an environment in the vscode-python-environments sidebar selects a “workspace environment” (and triggers a Hatch env sync). But that doesn’t explain that VS Code also remembers which global environment each project has?

    That confusion is why I filed microsoft/vscode-python-environments#1485 and didn’t try to integrate with the global environment yet. @eleanorjboyd could you maybe help us out here?

  2. grst commented on Jul 6, 2026

    @grst
    Author

    I wasn't even aware that a vscode-python-environment sidebar exists 👀

  3. flying-sheep commented on Oct 21, 2026

    @flying-sheep
    Member

    OK, so since the Python extension uses the Python Environments extension by default now, I think this isn’t as relevant anymore.

    FYI, the Envs extension introduced a new concept called “project’s active environment” which is different from the legacy global active environment set by Select Interpreter. Most extensions like Ruff, ty, … support the project environment at this point, so the legacy global environment should be no longer relevant. If the project env isn’t recognized by an extension you use, please report it there, it’s a big hole at this point!

    Using the Envs extension’s panel’s “Set as project interpreter” button (see below) will cause the Hatch extension to sync/create the env as you wanted!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions