Skip to content

Instantly share code, notes, and snippets.

@pzelnip
Created January 29, 2023 19:29
Show Gist options
  • Save pzelnip/6265212ad8190e2202d7474f05f7384a to your computer and use it in GitHub Desktop.
Save pzelnip/6265212ad8190e2202d7474f05f7384a to your computer and use it in GitHub Desktop.
Example of using variables to minimize duplication of path to Python Virtual Env in VS Code tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"options": {
"env": {
// Path to VENV from home directory
"PYTHON_VENV": "/.envs/myvirtualenv/bin/activate"
}
},
"tasks": [
{
"label": "Run Make in VENV",
"type": "shell",
"command": "source ${userHome}$PYTHON_VENV && make some-target",
"presentation": {
"focus": true,
},
"problemMatcher": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment