tiangolo / typer

Typer, build great CLIs. Easy to code. Based on Python type hints.

Home Page:https://typer.tiangolo.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New setting to increase the width of the rich (exception) output

brot opened this issue · comments

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Typer documentation, with the integrated search.
  • I already searched in Google "How to X in Typer" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to Typer but to Click.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

import typer

app = typer.Typer()


@app.command()
def main(name: str = "morty"):
    deep_dict_or_json = {
        "this_is_a_long_key": {
            "this_is_the_next_long_key": {
                "this_is_the_next_long_key": {
                    "this_is_the_next_long_key": {
                        "this_is_the_next_long_key": {
                            "this_is_the_next_long_key": {
                                "this_is_the_next_long_key": {
                                    "this_is_the_next_long_key": {
                                        "this_is_the_next_long_key": {
                                            "this_is_the_next_long_key": {
                                                "and_once_again_a_very_long_key": {
                                                    "but_this_is_not_the_end": {"end": True}
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    print(name + 3)


if __name__ == "__main__":
    app()

Description

If I want to include the locals in the nice rich output and such a local includes a very big and deep dictionary (e.g: Kubernetes pod description) the output is very long, although I have a lot of horizontal space in my terminal.

Wanted Solution

So I want to be able to increase the width of the yellow and red rich exception border to make the output more useful and readable

Wanted Code

app = typer.Typer(pretty_exceptions_with=120)

Alternatives

No response

Operating System

macOS

Operating System Details

No response

Typer Version

0.7.0

Python Version

3.11.1

Additional Context

No response

hi, would it be okay if I made a PR for it?