Open Vinnish-A opened 1 month ago
Thanks for the write-up! Is it not possible to add a breakpoint using the IDE at the same place that you would insert pdb.set_trace()
and then debug using the IDE? Here are the docs for Python debugging.
Debugging the entire file is not a problem, and debugging using configuration files is also fine. What I mentioned is similar to debugging small-scale Python code within a single cell in Jupyter. It can be achieved through pdb.set_trace()
, but IDEs lack support for this method, with no variable exploration tool or top bar for debugging. If support for such methods could be added, I believe it would definitely be very useful.
I don't understand why one couldn't debug the entire file in that case. Could you perhaps share more about your workflow, maybe with an example file with some functions that you'd like to debug, and how you currently debug those with pdb.set_trace()
?
Are you perhaps using Cmd+Enter (or Ctrl+Enter in windows/linux) to execute a code snippet that contains pdb.set_trace()
?
Just like in R, you can debug the entire file using source()
, or you can debug each function one by one using browser()
or breakpoints on the IDE side. For users, the latter is relatively more natural and friendly. However, it doesn't matter if not available; after all, what I claim is that the IDE does not support pdb.set_trace()
, which is not even a problem but just an enhancement.
Anyway, wish you a happy day!
Ah, I think I understand. Are you saying that sometimes setting up a configuration file for debugging is too much effort, and you'd just want to be able to use something in the native language (e.g.pdb.set_trace()
) but you'd like it to still use the IDE's debugging capabilities?
Yes, that's what I want to say! Thank you for being so nice!
Respected developers,
For R users, it is very natural to debug a single function through breakpoints. In a large Python project I am currently involved in, it is often impractical to debug the entire code from scratch most of the time, and I prefer to debug individual functions. While debugging within cells is possible in Jupyter, it has been reported in a recent issue that this feature is temporarily not implemented.
The approach I am currently taking is to insert
pdb.set_trace()
into the code, which is similar to insertingbrowser()
in R. However, the difference is that at present, Positron and other IDEs do not provide much support forpdb.set_trace()
, there is no variable panel or other prompts.So I think that by adding support for debugging tools like pdb, it can better help users debug single Python function.
Thank you for reading this issue and have a good day!