Get from zero to a working debugging session in a few minutes.
Before you begin, make sure Dapper is installed. See the Installation guide if you haven't done this yet.
Open a terminal and launch the Dapper debug adapter:
python -m dapper.adapter --port 4711The adapter will listen on port 4711 and wait for a client to connect. Keep this terminal open while you debug.
Create or open .vscode/launch.json in your project and add this configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Dapper",
"type": "python",
"request": "attach",
"debugServer": 4711
}
]
}This tells VS Code to attach to the running adapter rather than launching its own.
Open the Python file you want to debug in VS Code. Click in the left gutter next to a line of code to set a breakpoint (a red dot will appear).
Press F5 or open the Run and Debug panel (Ctrl+Shift+D) and click Start Debugging. VS Code will connect to the Dapper adapter and run your program. Execution will pause at your breakpoint.
When execution is paused at a breakpoint:
- The Variables panel (left sidebar) shows local and global variables in the current scope.
- Hover over any variable in the editor to see its value in a tooltip.
- Use the Debug Console (
Ctrl+Shift+Y) to evaluate arbitrary expressions in the current frame. - Use the Call Stack panel to navigate between stack frames.
- Using VS Code — full walkthrough of Dapper's VS Code integration
- Troubleshooting — common connection, breakpoint, and configuration issues
- Async Debugging — advanced debugging scenarios