-
-
Save amichuda/354d5b11581f7799885c3c0b7ce7da8e to your computer and use it in GitHub Desktop.
Debugging Bokeh server applications using Visual Studio Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ptvsd | |
# attach to VS Code debugger if this script was run with BOKEH_VS_DEBUG=true | |
if os.environ['BOKEH_VS_DEBUG'] == 'true': | |
# 5678 is the default attach port in the VS Code debug configurations | |
print('Waiting for debugger attach') | |
ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True) | |
ptvsd.wait_for_attach() | |
def main(): | |
"""Create the root and add it to `curdoc()`.""" | |
raise NotImplementedError() | |
if __name__.startswith('bk_script'): | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Bokeh server", | |
"type": "python", | |
"request": "attach", | |
"port": 5678, | |
"host": "localhost", | |
"preLaunchTask": "launch Bokeh server" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "launch Bokeh server", | |
"type": "shell", | |
"isBackground": true, | |
"command": "bokeh", | |
"args": [ | |
"serve", | |
"app.py" | |
], | |
"options": { | |
"env": { | |
"BOKEH_VS_DEBUG": "true" | |
} | |
}, | |
"problemMatcher": { | |
"fileLocation": [ | |
"relative", | |
"${workspaceFolder}" | |
], | |
"pattern": [ | |
{ | |
"regexp": ".", | |
"file": 1, | |
"location": 2, | |
"message": 3 | |
} | |
], | |
"background": { | |
"activeOnStart": true, | |
"endsPattern": "^.*Waiting for debugger attach.*", | |
"beginsPattern": "^this should not match on anything" | |
// "^.*\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3} 200 GET.*" | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment