Skip to content
Myr

💄 Unify the width of the Rich console for help and errors (#788)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Matěj Račinský · committed by GitHub · parent 8c0c003 · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Co-authored-by: svlandeg <svlandeg@github.com>

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:typer/main.py+6 added-2 removed
37 unmodified lines
38from .utils import get_params_from_function3940try:41 import rich42 from rich.console import Console42 from rich.traceback import Traceback4345 console_stderr = Console(stderr=True)44 from . import rich_utils4546 console_stderr = rich_utils._get_rich_console(stderr=True)4748except ImportError: # pragma: no cover49 rich = None # type: ignore5051_original_except_hook = sys.excepthook
18 unmodified lines
70 click_path = os.path.dirname(click.__file__)71 supress_internal_dir_names = [typer_path, click_path]72 exc = exc_value73 if rich:74 from .rich_utils import MAX_WIDTH7576 rich_tb = Traceback.from_exception(77 type(exc),78 exc,79 exc.__traceback__,80 show_locals=exception_config.pretty_exceptions_show_locals,81 suppress=supress_internal_dir_names,82 width=MAX_WIDTH,83 )84 console_stderr.print(rich_tb)85 return86 tb_exc = traceback.TracebackException.from_exception(exc)
987 unmodified lines