Skip to content

Commit

Permalink
Use rich.traceback with debug mode (#10832)
Browse files Browse the repository at this point in the history
  • Loading branch information
q0w committed Feb 1, 2022
1 parent 4a508c2 commit d7fed8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/10791.feature.rst
@@ -0,0 +1 @@
Print the exception via ``rich.traceback``, when running with ``--debug``.
3 changes: 3 additions & 0 deletions src/pip/_internal/cli/base_command.py
Expand Up @@ -10,6 +10,8 @@
from optparse import Values
from typing import Any, Callable, List, Optional, Tuple

from pip._vendor.rich import traceback as rich_traceback

from pip._internal.cli import cmdoptions
from pip._internal.cli.command_context import CommandContextMixIn
from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
Expand Down Expand Up @@ -215,6 +217,7 @@ def exc_logging_wrapper(*args: Any) -> int:
run = intercepts_unhandled_exc(self.run)
else:
run = self.run
rich_traceback.install(show_locals=True)
return run(options, args)
finally:
self.handle_pip_version_check(options)

0 comments on commit d7fed8f

Please sign in to comment.