Description
Summary
Use the rich package to create detailed traceback messages
Rationale
Python tracebacks are hard to parse and often not sufficiently informative to support debugging. The 'rich' package includes facilities for generating detailed tracebacks that are (1) easy to read, and (2) show the values of local variables.
Description
I recently saw a really nice traceback generated when running pip with the --debug option. I tracked this down to the rich package. Looking at the pip package (see https://github.com/pypa/pip/blob/29cd0c4eb72458c946ca5d681a3a3a74a015a0d9/src/pip/_vendor/rich/_extension.py#L7), I think the following is enough to setup rich tracebacks:
import rich.traceback
rich.traceback.install(show_locals=True)
See the rich documentation: https://rich.readthedocs.io/en/stable/traceback.html
I'm not sure where it makes sense to include this import, though.
Additional information
None.