Skip to content

Instantly share code, notes, and snippets.

@RyanHill-MSFT
Last active August 25, 2020 20:24
Show Gist options
  • Save RyanHill-MSFT/78d137487fb8bf8b32874331cecea8b0 to your computer and use it in GitHub Desktop.
Save RyanHill-MSFT/78d137487fb8bf8b32874331cecea8b0 to your computer and use it in GitHub Desktop.
1. settings.json is configured so that VS Code can configure the functions host environment
{
"azureFunctions.deploySubpath": ".",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.pythonVenv": ".venv",
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~3",
"debug.internalConsoleOptions": "neverOpen"
}
2. tasks.json is configured so that VS Code can install your requirements.txt against your virtual environment
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-watch",
"isBackground": true,
"dependsOn": "pipInstall"
},
{
"label": "pipInstall",
"type": "shell",
"windows": {
"command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
},
"problemMatcher": []
}
]
}
3. launch.json waits on task.json to start so it can attach the debugger `func host`
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment