[DMP 2025]: Pippy Debugger Integration#113
[DMP 2025]: Pippy Debugger Integration#113therealharshit wants to merge 10 commits intosugarlabs:masterfrom
Conversation
Introduced a new debug-icon.svg Integrated the icon into the main toolbar for triggering debug functionality
Added _get_current_code() method to read code from active tab's file Integrated code extraction into _debug_button_cb to support debugging workflow
Sends POST request to /debug endpoint with code payload
Created separate VTE terminal for displaying debug output Added color theming for debug terminals Introduced UI with buttons to toggle between output and debug terminals Implemented logic to feed LLM-generated debug responses into debug terminal
…background thread Wrapped blocking `requests.post` call in a separate thread to avoid freezing GTK main loop Used `GLib.idle_add` to safely update VTE terminal from background thread Format debug tips by stripping markdown and adjusting newlines
Introduced 'output-terminal.svg' and 'debug-terminal.svg' icons. Set those icons for btn_output and btn_debug. Applied custom CSS to style the switch_box.
- Parses headings, lists, code blocks, and inline formatting. - Converts Markdown to ANSI-colored terminal output. - Integrated parser output into debug terminal via feed. - Change text color of debug terminal.
- Implements _debug_terminal_cb to send code to /context endpoint. - Parses response using markdown_parser and renders in debug terminal. - Uses threading to avoid blocking UI during network call.
- Added API_URL and X_API_KEY constants for easier configuration - Updated debug and context requests to use shared API settings - Improved markdown_parser with better heading and list handling - Filtered out shebang/coding lines when reading files - Replaced print statements with VTE output for consistency
|
Reviewed cfeb4c1, not tested. |
- Added detailed comments to markdown parser for clarity. - Reformatted code to match existing style guidelines. - Updated `_reset_debug_vte` to clear screen consistently. - Extended inverted color toggle to also update debug terminal colors.
|
@therealharshit there's still these items to handle;
|
@chimosky If I recall correctly, we had discussed making the API key handling more central to Sugar, instead of implementing it separately in each activity. |
I remember the conversation, I haven't been able to get to it. I'll see what I can do. |
Overview
This PR introduces the Pippy Debugger, bringing LLM-powered debugging support into the Pippy activity. Kids can now send their code for analysis and view helpful debugging suggestion.
Key Features
Dedicated Debug Terminal
A new terminal is added alongside the output terminal to show debugging feedback in a clear, separate space.
One-Click Debugging
A toolbar button with a new debug icon lets users easily run their code and request debugging help.
Readable AI Feedback
Debugging tips are displayed with proper formatting like including headings, lists, and code blocks which makes the suggestions easier to follow.
Responsive Experience
Debugging requests no longer freeze the UI, ensuring a smooth experience while results are being fetched.
Cleaner Code Context
Only the relevant code is sent for debugging (ignoring boilerplate like shebang lines), so feedback is more focused.
UI Previews
Updated Pippy UI
Debugger's output
ToDO
API_URLwith sugarAI URL after merging of PR [DMP 2025]: Add/debugendpoint for Pippy Debugger sugar-ai#28 .API_KEY.Added dependencies
threadingmodule for background tasks.requestslibrary for making API calls.Notes for Reviewer
@chimosky as you’ve previously reviewed most of this code, could you please review it again.
Project Reference
This work is part of DMP 2025 (#95).