forked from google/mesop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add guide for debugging with Mesop (google#427)
- Loading branch information
1 parent
f5f0cf3
commit b490d4e
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Remote Attach", | ||
"type": "python", | ||
"request": "attach", | ||
"connect": {"host": "localhost", "port": 5678}, | ||
"pathMappings": [{"localRoot": "${workspaceFolder}", "remoteRoot": "."}], | ||
"justMyCode": true | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Debugging | ||
|
||
VS Code is recomended for debugging your Mesop app, but you should be able to debug Mesop in other IDEs. | ||
|
||
## Debugging in VS Code | ||
|
||
**Pre-requisite:** ensure VS Code is downloaded. | ||
|
||
1. Install the [Python Debugger VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy). | ||
|
||
2. Include the following in your `.vscode/launch.json`: | ||
|
||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Remote Attach", | ||
"type": "python", | ||
"request": "attach", | ||
"connect": { "host": "localhost", "port": 5678 }, | ||
"pathMappings": [ | ||
{ "localRoot": "${workspaceFolder}", "remoteRoot": "." } | ||
], | ||
"justMyCode": true | ||
} | ||
] | ||
} | ||
``` | ||
|
||
3. At the top of your Mesop app (e.g. main.py), including the following snippet to start the debug server: | ||
|
||
```py | ||
import debugpy | ||
|
||
debugpy.listen(5678) | ||
``` | ||
|
||
4. Connect to your debug server by going to the Run & Debug tab in VS Code and selecting "Python: Remote Attach". | ||
|
||
Congrats you are now debugging your Mesop app! | ||
|
||
To learn more about Python debugging in VS code, read VS Code's [Python debugging guide](https://code.visualstudio.com/docs/python/debugging). |
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