News for hackers. Stuff that matters.
Re:Make Your Python CLI Tools Pop with Rich by thrdbndndn on Thursday January 20, 2022 @10:30PM (#30018793)
What's the use case for `inspect`?

Do I need to manually choose what to inspect in case of exception?

If it can be done by simply turn on a switch and all the exception will automatically colorful, then I can see it being somewhat useful; but for my toy script I would just run it in debugger which is even better for debugging.

Re:Make Your Python CLI Tools Pop with Rich by VTimofeenko on Friday January 21, 2022 @01:05AM (#30019782)
I have been using it in an environment where I could not hook in IDE debugger but could sprinkle in breakpoint()s and rich.inspect away to my heart's content.
Re:Make Your Python CLI Tools Pop with Rich by 0x008 on Friday January 21, 2022 @01:33AM (#30019954)
Which environment is that? So far I have been able to use a debugger everywhere.

If all fails use pdb.trace()

Re:Make Your Python CLI Tools Pop with Rich by VTimofeenko on Friday January 21, 2022 @02:59AM (#30020519)
I had no way to punch holes through a bunch of nested ssh sessions on a tightened down production environment
Re:Make Your Python CLI Tools Pop with Rich by usrme on Friday January 21, 2022 @03:06AM (#30020576)
If you're fortunate enough to use Python 3.7 or newer, then you can forego the importing of 'pdb' and using 'pdb.set_trace()' (I think you had a small omission there) in favor of just writing 'breakpoint()'[1] directly.

---

[1]: https://docs.python.org/3/whatsnew/changelog.html#id325

Re:Make Your Python CLI Tools Pop with Rich by 0x008 on Sunday January 23, 2022 @11:49AM (#30047668)
What is the difference? Set trace will basically hold the code at that line (breakpoint) and drop you into the interactive debugger session. It seems like syntactic sugar.

edit: but what seems like interesting concept is to overwrite sys.breakpoint_hook to start a custom debug server allowing for remote debugger attachment.