From 8c7138a8db5a36449021c2c452d15bf06e2cdb60 Mon Sep 17 00:00:00 2001 From: indivar Date: Sun, 8 Jan 2023 00:39:18 +0530 Subject: [PATCH] add `pretty_exceptions_width` in Typer class add `pretty_exceptions_width` in typer class to be used by `DeveloperConfigException` to allow setting width of traceback boxes. --- typer/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/typer/main.py b/typer/main.py index 9de5f5960..4c57d302f 100644 --- a/typer/main.py +++ b/typer/main.py @@ -75,6 +75,7 @@ def except_hook( exc.__traceback__, show_locals=exception_config.pretty_exceptions_show_locals, suppress=supress_internal_dir_names, + width=exception_config.pretty_exceptions_width, ) console_stderr.print(rich_tb) return @@ -139,6 +140,7 @@ def __init__( pretty_exceptions_enable: bool = True, pretty_exceptions_show_locals: bool = True, pretty_exceptions_short: bool = True, + pretty_exceptions_width: int = 100, ): self._add_completion = add_completion self.rich_markup_mode: MarkupMode = rich_markup_mode @@ -146,6 +148,7 @@ def __init__( self.pretty_exceptions_enable = pretty_exceptions_enable self.pretty_exceptions_show_locals = pretty_exceptions_show_locals self.pretty_exceptions_short = pretty_exceptions_short + self.pretty_exceptions_width = pretty_exceptions_width self.info = TyperInfo( name=name, cls=cls, @@ -323,6 +326,7 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any: pretty_exceptions_enable=self.pretty_exceptions_enable, pretty_exceptions_show_locals=self.pretty_exceptions_show_locals, pretty_exceptions_short=self.pretty_exceptions_short, + pretty_exceptions_width=self.pretty_exceptions_width, ), ) raise e