Skip to content

Conversation

@dmadisetti
Copy link
Collaborator

📝 Summary

This PR adds a Debug Adapter Protocol (DAP) server to marimo, enabling debugging capabilities through VS Code and other DAP-compatible debuggers.

Usage

The debug server automatically starts when running marimo edit and listens on a dynamically assigned port. VS Code can connect using:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Remote Attach",
            "type": "debugpy",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "."
                }
            ]
        }
    ]
}

Current Status

Working:

  • VS Code can connect to the debug server
  • Initialize handshake completes successfully
  • Message parsing and response generation works

🔄 Next Steps:

  • Integrate with marimo's cell execution system
  • Implement actual breakpoint functionality
  • Add cell-specific debugging features

Alternative Solution

This PR implements Solution 1 (DAP protocol). There's also Solution 2 which uses debugpy out of the box by temporarily disabling marimo's stack trace rewriting feature. While easier to implement, Solution 2 has limitations:

  • Users step through marimo internals instead of cells
  • Can't be used with edit server
  • Relies on environment detection
  • More brittle solution

Solution 1 provides the true "native" debugging experience but requires more development time to implement full DAP protocol features.

@vercel
Copy link

vercel bot commented Aug 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2025 2:22am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants