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.
z3c0|3 years ago
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...