Skip to content

Instantly share code, notes, and snippets.

@mattmc3 mattmc3/tasks.json
Created Apr 6, 2017

What would you like to do?
VSCode tasks for Python 3
// # Be sure to set up virtualenv
// python3 -m venv .env
// source .env/bin/activate
// pip install --upgrade pip
// pip freeze > requirements.txt
// ${workspaceRoot} the path of the folder opened in VS Code
// ${file} the current opened file
// ${fileBasename} the current opened file's basename
// ${fileDirname} the current opened file's dirname
// ${fileExtname} the current opened file's extension
// ${cwd} the task runner's current working directory on startup
"version": "0.1.0",
"command": "bash",
"isShellCommand": true,
"showOutput": "always",
"options": {
"cwd": "${workspaceRoot}"
"args": [
"tasks": [
"taskName": "Python Run",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["source ${workspaceRoot}/.env/bin/activate; echo \"running ${file}\"; python ${file}; deactivate"]
"taskName": "pytest",
"suppressTaskName": true,
"isTestCommand": true,
"args": ["source ${workspaceRoot}/.env/bin/activate; py.test; deactivate"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.