Skip to content

rs_rich

Generated from the type stubs by scripts/gen_python_api.py; do not edit.

Rich-compatible terminal rendering, backed by the rs-rich Rust port.

Every class here is implemented in Rust (rs_rich._native); these modules only re-export them under Rich's module paths, so a program can move from rich by changing its imports. See the supported surface in the README.

Console

file instance-attribute

file: IO[str]

width instance-attribute

width: int

height instance-attribute

height: int

size instance-attribute

size: ConsoleDimensions

quiet instance-attribute

quiet: bool

soft_wrap instance-attribute

soft_wrap: bool

record instance-attribute

record: bool

is_interactive instance-attribute

is_interactive: bool

highlighter instance-attribute

highlighter: Callable[[Union[str, Text]], Text]

is_terminal property

is_terminal: bool

is_dumb_terminal property

is_dumb_terminal: bool

color_system property

color_system: Optional[str]

encoding property

encoding: str

no_color property

no_color: bool

legacy_windows property

legacy_windows: bool

safe_box property

safe_box: bool

tab_size property

tab_size: int

stderr property

stderr: bool

is_alt_screen property

is_alt_screen: bool

get_time property

get_time: Callable[[], float]

get_datetime property

get_datetime: Callable[[], Any]

options property

options: ConsoleOptions

print

print(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, no_wrap: Optional[bool] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, width: Optional[int] = None, height: Optional[int] = None, crop: bool = True, soft_wrap: Optional[bool] = None, new_line_start: bool = False) -> None

out

out(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, highlight: Optional[bool] = None) -> None

log

log(*objects: Any, sep: str = ' ', end: str = '\n', style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, log_locals: bool = False, _stack_offset: int = 1) -> None

rule

rule(title: str = '', *, characters: str = '─', style: Optional[StyleType] = None, align: AlignMethod = 'center') -> None

line

line(count: int = 1) -> None

clear

clear(home: bool = True) -> None

bell

bell() -> None

show_cursor

show_cursor(show: bool = True) -> bool

set_alt_screen

set_alt_screen(enable: bool = True) -> bool

update_screen

update_screen(renderable: RenderableType, *, region: Optional[Tuple[int, int, int, int]] = None, options: Optional[ConsoleOptions] = None) -> None

update_screen_lines

update_screen_lines(lines: List[List[Segment]], x: int = 0, y: int = 0) -> None

input

input(prompt: Union[str, Text, None] = None, *, markup: bool = True, emoji: bool = True, password: bool = False, stream: Optional[IO[str]] = None) -> str

print_json

print_json(json: Optional[str] = None, *, data: Any = None, indent: Union[None, int, str] = 2, highlight: bool = True, skip_keys: bool = False, ensure_ascii: bool = False, check_circular: bool = True, allow_nan: bool = True, default: Optional[Callable[[Any], Any]] = None, sort_keys: bool = False) -> None

measure

measure(renderable: RenderableType, *, options: Optional[ConsoleOptions] = None) -> Measurement

render

render(renderable: RenderableType, options: Optional[ConsoleOptions] = None) -> List[Segment]

render_lines

render_lines(renderable: RenderableType, options: Optional[ConsoleOptions] = None, *, style: Optional[StyleType] = None, pad: bool = True, new_lines: bool = False) -> List[List[Segment]]

render_str

render_str(text: str, *, style: Optional[StyleType] = None, justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None) -> Text

get_style

get_style(name: StyleType, *, default: Optional[StyleType] = None) -> Style

push_theme

push_theme(theme: Theme, *, inherit: bool = True) -> None

pop_theme

pop_theme() -> None

use_theme

use_theme(theme: Theme, *, inherit: bool = True) -> ThemeContext

capture

capture() -> Capture

begin_capture

begin_capture() -> None

end_capture

end_capture() -> str

export_text

export_text(*, clear: bool = True, styles: bool = False) -> str

save_text

save_text(path: str, *, clear: bool = True, styles: bool = False) -> None

export_html

export_html(*, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, inline_styles: bool = False) -> str

save_html

save_html(path: str, *, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, inline_styles: bool = False) -> None

export_svg

export_svg(*, title: str = 'Rich', theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None) -> str

save_svg

save_svg(path: str, *, title: str = 'Rich', theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None) -> None

push_render_hook

push_render_hook(hook: Any) -> None

pop_render_hook

pop_render_hook() -> None

set_live

set_live(live: Any) -> bool

clear_live

clear_live() -> None

set_window_title

set_window_title(title: str) -> bool

status

status(*args: Any, **kwargs: Any) -> Any

pager

pager(*args: Any, **kwargs: Any) -> Any

screen

screen(*args: Any, **kwargs: Any) -> Any

print_exception

print_exception(*args: Any, **kwargs: Any) -> Any

get_console

get_console() -> Console

The global console rs_rich.print writes to, created on first use.

reconfigure

reconfigure(**kwargs: Any) -> None

rich.reconfigure: replace the global console with Console(**kwargs).

Rich changes the existing console in place; rs_rich's native console cannot be, so get_console() returns a new object afterwards.

print

print(*objects: Any, sep: str = ' ', end: str = '\n', file: Optional[IO[str]] = None, flush: bool = False) -> None

rich.print: print objects to the global console (or to file).

print_json

print_json(json: Optional[str] = None, *, data: Any = None, **kwargs: Any) -> None

rich.print_json: pretty-print JSON on the global console.

inspect

inspect(obj: Any, **kwargs: Any) -> None

rich.inspect: provided by _native.inspect once the code area adds it.