Re:Textual TUI framework for Python adds CSS renderer
by willm on Sunday October 23, 2022 @04:42PM
(#33310072)
Cheers. Rich repr has become essential in my workflow as well. It's one of those small quality of life things that makes for one less thing to think about.
Re:Textual TUI framework for Python adds CSS renderer
by newrotik on Sunday October 23, 2022 @05:58PM
(#33310689)
Could you elaborate on how you use the tool for the two purposes you mentioned?
Re:Textual TUI framework for Python adds CSS renderer
by z3c0 on Monday October 24, 2022 @09:45AM
(#33316528)
Of course.
I use __rich_repr__ to make object representations more succinct[1].
This can also be used to make pretty custom exceptions. You can also use rich.Console.print_exception to output formatted stack traces, with options for including locals, suppressing certain errors, or limiting frames[2]. Pretty great for spark, which usually vomits a novella upon erring.
Also, %load_ext rich in a IPython shell to pretty print all output, exceptions or not.
[1]: https://rich.readthedocs.io/en/stable/pretty.html#rich-repr-...
[2]: https://rich.readthedocs.io/en/stable/reference/console.html...
I just wanted to say that rich is a great tool that I'm very appreciative of, and __rich_repr__ is a godsend for debugging datasets without vomiting an overload of text into my terminal. Or consolidating spark's awful, multi-language stack traces. Excellent work. Textual is a lot of fun too, and I've been looking forward to this update. Thank you!