An extension to manage Hatch environments through vscode-python-environments.
To make use of it, make sure your user settings contain "python.useEnvironmentsExtension": true.
- List all configured Hatch environments
- Provide controls to set them as active environment for your project, activate them in a terminal, and delete them from disk
- Temporarily modify an environment’s packages using the configured
installer - Define a
hatch.envInterpretercommand for use inlaunch.jsonortasks.json, see below
Since many actions currently use hatch run and therefore sync the environment, temporary package changes can be quickly undone, especially removing packages installed as dependencies.
Persistent modifications to the installed packages should be done by editing Hatch’s envs configuration.
-
hatch.envInterpreter: not an interactive command, but rather for use inlaunch.jsonortasks.jsonvia variable substitution, e.g. forcommandintasks.jsonorpythoninlaunch.json:The command supports the following
args:env: name of the environment (defaults to"default")workspace: path to the workspace root (defaults to the first currently open workspace)
It can be used without going through
inputsusing just${command:hatch.envInterpreter}to always use thedefaultenvironment instead of the currently active one.
hatch.executable: path to thehatchexecutable (supports~expansion). Defaults to the output ofwhich hatch.
- It’s pretty unclear which environments exist on disk and which don’t
- We list internal envs that users don’t usually interact with, such as
hatch-uvandhatch-build

{ // launch.json "version": "0.2.0", "configurations": [ { "name": "Python: Debug script", "type": "debugpy", "request": "launch", "python": "${input:scriptsInterpreter}", "program": "${file}", }, ], "inputs": [ { "id": "scriptsInterpreter", "type": "command", "command": "hatch.envInterpreter", "args": { "env": "scripts" }, }, ], }