Open
Description
The __init__
method for RichHandler
defines the tracebacks_code_width
parameter as follows:
Line 79 in 8732dc5
This type hint (int
) is incorrect. According to the docs:
tracebacks_code_width (int, optional) – Number of code characters used to render tracebacks, or None for full width. Defaults to 88.
Testing this, it is indeed possible to pass tracebacks_code_width=None
, which produces the expected result when run.
So, the type hint should be int | None
or alternatively Optional[int]
. Otherwise type checkers complain:
- I've checked docs and closed issues for possible solutions.
- I can't find my issue in the FAQ.
Platform details (click to expand)
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=254 ColorSystem.TRUECOLOR> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = 'truecolor' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 18 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=254, height=18), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=254, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=18, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=254, height=18) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 254 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'CLICOLOR': None, │
│ 'COLORTERM': 'truecolor', │
│ 'COLUMNS': None, │
│ 'JPY_PARENT_PID': None, │
│ 'JUPYTER_COLUMNS': None, │
│ 'JUPYTER_LINES': None, │
│ 'LINES': None, │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': 'vscode', │
│ 'TERM': 'xterm-256color', │
│ 'TTY_COMPATIBLE': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Linux"