Show HN: Chatpdb – GPT for your Python debugger

  • Posted 2 weeks ago by the1024
  • 1 points
https://github.com/Never-Over/chatpdb
chatpdb - gpt for your python debugger

ChatGPT can be an awesome tool for quickly diagnosing issues from error output, but pasting snippets into the chat window often misses important context and forces you to switch focus and lose your flow. That’s why we built `chatpdb` - a python debugger with ChatGPT!

Simply use chatpdb like you would use pdb or ipdb; it’s a drop in replacement with the exact same functionality. The only addition is the new `y` keyword, which will trigger a response from ChatGPT. chatpdb automatically passes relevant context about your program, including the source code, stack trace, and error information if available to ChatGPT.

> /Programming/test-chatpdb/lib.py(2)echo_platform()

      1 def echo_platform(platform: str):
----> 2 print("You are running on:" + platform)

      3
ipdb> y

The exception occurred because the function `echo_platform` tries to concatenate the string "You are running on:" with the `platform` variable, which is `None`. [...]

If you have a more specific question you can also supply a prompt to `y`, with the syntax `y "prompt"`

It’s easy to install and set up:

# bash

pip install chatpdb export OPENAI_API_KEY=....

# python

import chatpdb chatpdb.set_trace()

chatpdb meets you where you are – AI tooling that’s only invoked when you need it. We hope you give it a try! We’d love any feedback or suggestions.

docs - https://github.com/Never-Over/chatpdb

0 comments