-
Notifications
You must be signed in to change notification settings - Fork 48
[DMP 2025]: Pippy Debugger Integration #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[DMP 2025]: Pippy Debugger Integration #113
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
pippy_app.py
Outdated
| def _vte_set_debug_colors(self, bg, fg): | ||
| if _has_new_vte_api(): | ||
| foreground = Gdk.RGBA(); foreground.parse(bg) | ||
| background = Gdk.RGBA(); background.parse(fg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changing the style in this code, please stick to the existing style here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in f63b2d9.
pippy_app.py
Outdated
|
|
||
| def _reset_debug_vte(self): | ||
| self._debug_vte.grab_focus() | ||
| self._debug_vte.feed(b'\x1B[H\x1B[J\x1B[0;39m') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment here saying why this is here would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in f63b2d9.
|
|
||
| line = re.sub(r"\*\*(.*?)\*\*", r"\033[2m\1\033[0m", line) | ||
|
|
||
| line = re.sub(r"(?<!\*)\*(?!\*)(.*?)\*(?!\*)", r"\033[2m\1\033[0m", line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While these regexes are great, a comment for each telling what their target is would be awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in f63b2d9.
|
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).