You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
The output of the command above is:
note that the width of the table for help is much higher than the width of stacktrace. The max width for stack trace is only 100, which is very small, making it very hard to read for many our use-cases.
Specifically, the discrepancy is caused by this:
the help formatting is here https://github.com/tiangolo/typer/blob/0.12.0/typer/core.py#L674-L678 which calls https://github.com/tiangolo/typer/blob/0.12.0/typer/rich_utils.py#L126-L144 which sets the width to https://github.com/tiangolo/typer/blob/0.12.0/typer/rich_utils.py#L70 which is wither
TERMINAL_WIDTH
env var or None, leaving therich
package to figure it out.While in the exception hook, the https://github.com/tiangolo/typer/blob/0.12.0/typer/main.py#L53-L102 is used which calls the
rich
from https://github.com/tiangolo/typer/blob/0.12.0/typer/main.py#L72-L79 and there it does not set thewidth
so the default100
is used, see https://github.com/Textualize/rich/blob/v13.7.1/rich/traceback.py#L245. And the console used by the the except hook is created in https://github.com/tiangolo/typer/blob/0.12.0/typer/main.py#L44 while it should instead obtain the rich console which contains the styling. This would make them more consistent.This bug happens regardless of OS, although figuring out if the default showcase will be
80
or100
is platform-dependent to some extent.Operating System
Windows
Operating System Details
Windows 10
Typer Version
0.12.0
Python Version
Python 3.11.4
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions