Upgrading rich 1 to 2
Breaking1.3.1 → 2.3.1Breaking3New9Changed11Fixed8
BreakingUpgrade verdict
3 breaking changes.
In plain terms
- Renames _ratio.ratio_divide to _ratio.ratio_distribute.
- Renames JustifyValues to JustifyMethod, which is backwards incompatible.
- Enforces keyword arguments in Console and Text interfaces, which is backwards incompatible.
Must act 3 items need code or config changes
What you must change
Breaking3
Renames _ratio.ratio_divide to _ratio.ratio_distribute.
_ratio.ratio_divide_ratio.ratio_distributeRenames JustifyValues to JustifyMethod, which is backwards incompatible.
JustifyValuesJustifyMethodEnforces keyword arguments in Console and Text interfaces, which is backwards incompatible.
ConsoleTextAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- removed:
variable JustifyValues - changed:
field ConsoleOptions.justify: Optional[JustifyValues] → field ConsoleOptions.justify: Optional[JustifyMethod] - changed:
method Console.export_html(theme: TerminalTheme=…, clear: bool=…, code_format: str=…, inline_styles: bool=…) -> str → method Console.export_html(*, theme: TerminalTheme=…, clear: bool=…, code_format: str=…, inline_styles: bool=…) -> str - changed:
method Console.export_text(clear: bool=…, styles: bool=…) -> str → method Console.export_text(*, clear: bool=…, styles: bool=…) -> str - changed:
method Console.input(prompt: Union[str, Text]=…, *, markup: bool=…, emoji: bool=…) -> str → method Console.input(prompt: TextType=…, *, markup: bool=…, emoji: bool=…) -> str - changed:
method Console.log(*objects: Any, sep=…, end=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None → method Console.log(*objects: Any, sep=…, end=…, justify: JustifyMethod=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None - changed:
method Console.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…) -> None → method Console.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, justify: JustifyMethod=…, overflow: OverflowMethod=…, no_wrap: bool=…, emoji: bool=…, markup: bool=…, highlight: bool=…, width: int=…) -> None - changed:
method Console.print_exception(width: Optional[int]=…, extra_lines: int=…, theme: Optional[str]=…, word_wrap: bool=…) -> None → method Console.print_exception(*, width: Optional[int]=…, extra_lines: int=…, theme: Optional[str]=…, word_wrap: bool=…) -> None - changed:
method Console.render_lines(renderable: RenderableType, options: Optional[ConsoleOptions], style: Optional[Style]=…, pad: bool=…) -> List[List[Segment]] → method Console.render_lines(renderable: RenderableType, options: Optional[ConsoleOptions], *, style: Optional[Style]=…, pad: bool=…) -> List[List[Segment]] - changed:
method Console.render_str(text: str, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlighter: HighlighterType=…) -> Text → method Console.render_str(text: str, *, style: Union[str, Style]=…, justify: JustifyMethod=…, overflow: OverflowMethod=…, emoji: bool=…, markup: bool=…, highlighter: HighlighterType=…) -> Text - changed:
method Console.rule(title: str=…, character: str=…, style: Union[str, Style]=…) -> None → method Console.rule(title: str=…, *, character: str=…, style: Union[str, Style]=…) -> None - changed:
method Console.save_html(path: str, theme: TerminalTheme=…, clear: bool=…, code_format=…, inline_styles: bool=…) -> None → method Console.save_html(path: str, *, theme: TerminalTheme=…, clear: bool=…, code_format=…, inline_styles: bool=…) -> None - changed:
method Console.save_text(path: str, clear: bool=…, styles: bool=…) -> None → method Console.save_text(path: str, *, clear: bool=…, styles: bool=…) -> None - changed:
method ConsoleOptions.update(width: int=…, min_width: int=…, max_width: int=…, justify: JustifyValues=…) -> ConsoleOptions → method ConsoleOptions.update(width: int=…, min_width: int=…, max_width: int=…, justify: JustifyMethod=…, overflow: OverflowMethod=…, no_wrap: bool=…) -> ConsoleOptions - added:
class RenderHook - added:
field ConsoleOptions.no_wrap: Optional[bool] - added:
field ConsoleOptions.overflow: Optional[OverflowMethod] - added:
method Console.pop_render_hook() -> None - added:
method Console.push_render_hook(hook: RenderHook) -> None - added:
method RenderHook.process_renderables(renderables: List[ConsoleRenderable]) -> List[ConsoleRenderable] - added:
variable JustifyMethod - added:
variable OverflowMethod
- changed:
class Constrain → class Constrain(JupyterMixin)
- changed:
method Lines.justify(console: Console, width: int, align: Literal['none', 'left', 'center', 'right', 'full']=…) -> None → method Lines.justify(console: Console, width: int, justify: JustifyMethod=…, overflow: OverflowMethod=…) -> None
- removed:
variable c - removed:
variable e - added:
variable columns - added:
variable console
- added:
method LiveRender.restore_cursor() -> Control
- changed:
constructor RichHandler(level: int=…, console: Console=…) -> None → constructor RichHandler(level: int=…, console: Console=…, *, show_path: bool=…, enable_link_path: bool=…, highlighter: Highlighter=…) -> None - changed:
field RichHandler.KEYWORDS → field RichHandler.KEYWORDS: ClassVar[Optional[List[str]]] - added:
field RichHandler.HIGHLIGHTER_CLASS: ClassVar[Type[Highlighter]]
- changed:
constructor Markdown(markup: str, code_theme: str=…, justify: JustifyValues=…, style: Union[str, Style]=…, hyperlinks: bool=…) -> None → constructor Markdown(markup: str, code_theme: str=…, justify: JustifyMethod=…, style: Union[str, Style]=…, hyperlinks: bool=…) -> None - changed:
constructor Paragraph(justify: JustifyValues) -> None → constructor Paragraph(justify: JustifyMethod) -> None - changed:
field Paragraph.justify: JustifyValues → field Paragraph.justify: JustifyMethod
- changed:
constructor Padding(renderable: RenderableType, pad: PaddingDimensions=…, *, style: Union[str, Style]=…) → constructor Padding(renderable: RenderableType, pad: PaddingDimensions=…, *, style: Union[str, Style]=…, expand: bool=…)
- removed:
method Progress.log(*objects: Any, sep=…, end=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None - removed:
method Progress.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…) -> None - changed:
class Progress → class Progress(RenderHook) - changed:
constructor Progress(*columns: Union[str, ProgressColumn], console: Console=…, auto_refresh: bool=…, refresh_per_second: int=…, speed_estimate_period: float=…, get_time: GetTimeCallable=…) -> None → constructor Progress(*columns: Union[str, ProgressColumn], console: Console=…, auto_refresh: bool=…, refresh_per_second: int=…, speed_estimate_period: float=…, transient: bool=…, redirect_stdout: bool=…, redirect_stderr: bool=…, get_time: GetTimeCallable=…) -> None - changed:
constructor TextColumn(text_format: str, style: StyleType=…, justify: JustifyValues=…, markup: bool=…, highlighter: Highlighter=…) -> None → constructor TextColumn(text_format: str, style: StyleType=…, justify: JustifyMethod=…, markup: bool=…, highlighter: Highlighter=…) -> None - changed:
function track(sequence: Union[Sequence[ProgressType], Iterable[ProgressType]], description=…, total: int=…, auto_refresh=…, console: Optional[Console]=…, get_time: Callable[[], float]=…) -> Iterable[ProgressType] → function track(sequence: Union[Sequence[ProgressType], Iterable[ProgressType]], description=…, total: int=…, auto_refresh=…, console: Optional[Console]=…, transient: bool=…, get_time: Callable[[], float]=…) -> Iterable[ProgressType] - added:
method Progress.process_renderables(renderables: List[ConsoleRenderable]) -> List[ConsoleRenderable] - added:
variable console
- added:
property Style.link_id -> str
- changed:
constructor Table(*headers: Union[Column, str], title: Union[str, Text]=…, caption: Union[str, Text]=…, width: int=…, box: Optional[box.Box]=…, padding: PaddingDimensions=…, collapse_padding: bool=…, pad_edge: bool=…, expand: bool=…, show_header: bool=…, show_footer: bool=…, show_edge: bool=…, show_lines: bool=…, style: StyleType=…, row_styles: Iterable[StyleType]=…, header_style: StyleType=…, fo… → constructor Table(*headers: Union[Column, str], title: TextType=…, caption: TextType=…, width: int=…, box: Optional[box.Box]=…, padding: PaddingDimensions=…, collapse_padding: bool=…, pad_edge: bool=…, expand: bool=…, show_header: bool=…, show_footer: bool=…, show_edge: bool=…, show_lines: bool=…, style: StyleType=…, row_styles: Iterable[StyleType]=…, header_style: StyleType=…, footer_style: Styl… - changed:
field Column.justify: JustifyValues → field Column.justify: JustifyMethod - changed:
method Table.add_column(header: RenderableType=…, footer: RenderableType=…, header_style: StyleType=…, footer_style: StyleType=…, style: StyleType=…, justify: JustifyValues=…, width: int=…, ratio: int=…, no_wrap: bool=…) -> None → method Table.add_column(header: RenderableType=…, footer: RenderableType=…, header_style: StyleType=…, footer_style: StyleType=…, style: StyleType=…, justify: JustifyMethod=…, overflow: OverflowMethod=…, width: int=…, ratio: int=…, no_wrap: bool=…) -> None - added:
field Column.index: int - added:
field Column.overflow: OverflowMethod
- changed:
constructor Text(text: str=…, style: Union[str, Style]=…, justify: JustifyValues=…, end: str=…, tab_size: Optional[int]=…, spans: List[Span]=…) -> None → constructor Text(text: str=…, style: Union[str, Style]=…, *, justify: JustifyMethod=…, overflow: OverflowMethod=…, no_wrap: bool=…, end: str=…, tab_size: Optional[int]=…, spans: List[Span]=…) -> None - changed:
method Text.append(text: Union[Text, str], style: Union[str, Style]=…) -> None → method Text.append(text: Union[Text, str], style: Union[str, Style]=…) -> Text - changed:
method Text.highlight_regex(re_highlight: str, style: Union[str, Style]=…, style_prefix: str=…) -> int → method Text.highlight_regex(re_highlight: str, style: Union[GetStyleCallable, StyleType]=…, *, style_prefix: str=…) -> int - changed:
method Text.highlight_words(words: Iterable[str], style: Union[str, Style], case_sensitive: bool=…) -> int → method Text.highlight_words(words: Iterable[str], style: Union[str, Style], *, case_sensitive: bool=…) -> int - changed:
method Text.split(separator=…, include_separator: bool=…) -> Lines → method Text.split(separator=…, *, include_separator: bool=…) -> Lines - changed:
method Text.wrap(console: Console, width: int, justify: JustifyValues=…, tab_size: int=…) -> Lines → method Text.wrap(console: Console, width: int, *, justify: JustifyMethod=…, overflow: OverflowMethod=…, tab_size: int=…, no_wrap: bool=…) -> Lines - changed:
static method Text.assemble(*parts: Union[str, Text, Tuple[str, StyleType]], style: Union[str, Style]=…, justify: JustifyValues=…, end: str=…, tab_size: int=…) -> Text → static method Text.assemble(*parts: Union[str, Text, Tuple[str, StyleType]], style: Union[str, Style]=…, justify: JustifyMethod=…, overflow: OverflowMethod=…, end: str=…, tab_size: int=…) -> Text - changed:
static method Text.from_markup(text: str, style: Union[str, Style]=…, emoji: bool=…, justify: JustifyValues=…) -> Text → static method Text.from_markup(text: str, *, style: Union[str, Style]=…, emoji: bool=…, justify: JustifyMethod=…, overflow: OverflowMethod=…) -> Text - added:
function get_style(text: str) -> str - added:
method Text.rstrip_end(size: int) - added:
method Text.truncate(max_width: int, *, overflow: Optional[OverflowMethod]=…, pad: bool=…) -> None - added:
variable DEFAULT_JUSTIFY: JustifyMethod - added:
variable DEFAULT_OVERFLOW: OverflowMethod - added:
variable GetStyleCallable - added:
variable TextType - added:
variable console - added:
variable t - added:
variable test
- removed:
variable console