Skip to content

Upgrading rich 0.8 to 1

Breaking0.8.13 → 1.3.1Breaking2New22Changed19Fixed14Other1

BreakingUpgrade verdict

2 breaking changes.

  • Custom objects that define these special methods must rename them to the new names.
  • Code that read the string content of a Text object via its text property must now use plain instead.
2 items need code or config changes
Breaking2
Renames methods __console__ to __rich_console__ and __measure__ to __rich_measure__.
__console____rich_console____measure____rich_measure__
Renames the Text 'text' property to 'plain', so text.plain returns the string version of the Text instance.
TextText.textText.plain

Generated by DepDelta from published Python source. Not mixed with prose notes.

  • added: function get_console() -> Console
  • added: class Align(JupyterMixin)
  • added: constructor Align(renderable: RenderableType, align: AlignValues) -> None
  • added: variable AlignValues
  • added: variable console
  • changed: class Bar → class Bar(JupyterMixin)
  • changed: constructor Bar(total: float=…, completed: float=…, width: int=…, style: StyleType=…, complete_style: StyleType=…, finished_style: StyleType=…) → constructor Bar(total: float=…, completed: float=…, width: int=…, pulse: bool=…, style: StyleType=…, complete_style: StyleType=…, finished_style: StyleType=…, pulse_style: StyleType=…, animation_time: float=…)
  • added: variable PULSE_SIZE
  • changed: method Color.get_ansi_codes(foreground: bool=…) -> List[str] → method Color.get_ansi_codes(foreground: bool=…) -> Tuple[str, ...]
  • added: class Columns(JupyterMixin)
  • added: constructor Columns(renderables: Iterable[RenderableType], padding: PaddingDimensions=…, width: int=…, expand: bool=…, equal: bool=…, column_first: bool=…, right_to_left: bool=…) -> None
  • added: variable columns
  • added: variable console
  • added: variable files
  • removed: field ConsoleThreadLocals.control: List[str]
  • changed: constructor Console(color_system: Optional[Literal['auto', 'standard', '256', 'truecolor', 'windows']]=…, force_terminal: bool=…, theme: Theme=…, file: IO[str]=…, width: int=…, height: int=…, tab_size: int=…, record: bool=…, markup: bool=…, emoji: bool=…, highlight: bool=…, log_time: bool=…, log_path: bool=…, log_time_format: str=…, highlighter: Optional[HighlighterType]=…) → constructor Console(*, color_system: Optional[Literal['auto', 'standard', '256', 'truecolor', 'windows']]=…, force_terminal: bool=…, force_jupyter: bool=…, theme: Theme=…, file: IO[str]=…, width: int=…, height: int=…, tab_size: int=…, record: bool=…, markup: bool=…, emoji: bool=…, highlight: bool=…, log_time: bool=…, log_path: bool=…, log_time_format: str=…, highlighter: Optional[HighlighterType]…
  • changed: method Console.log(*objects: Any, sep=…, end=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None → method Console.log(*objects: Any, sep=…, end=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None
  • changed: method Console.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, emoji: bool=…, markup: bool=…, highlight: bool=…) -> None → method Console.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…) -> None
  • changed: method Console.render(renderable: RenderableType, options: Optional[ConsoleOptions]) -> Iterable[Segment] → method Console.render(renderable: RenderableType, options: ConsoleOptions) -> Iterable[Segment]
  • changed: method Console.render_str(text: str, style: Union[str, Style]=…, emoji: bool=…, markup: bool=…) -> Text → method Console.render_str(text: str, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlighter: HighlighterType=…) -> Text
  • added: function detect_legacy_windows() -> bool
  • added: method Console.clear(home: bool=…) -> None
  • added: method Console.control(control_codes: Union[Control, str]) -> None
  • added: method Console.input(prompt: Union[str, Text]=…, *, markup: bool=…, emoji: bool=…) -> str
  • changed: method Lines.justify(width: int, align: Literal['none', 'left', 'center', 'right', 'full']=…) -> None → method Lines.justify(console: Console, width: int, align: Literal['none', 'left', 'center', 'right', 'full']=…) -> None
  • removed: field Control.codes: str
  • changed: class Control(NamedTuple) → class Control
  • added: constructor Control(control_codes: str) -> None
  • added: function strip_control_codes(text: str, _translate_table=…) -> str
  • added: variable STRIP_CONTROL_CODES
  • changed: class Emoji → class Emoji(JupyterMixin)
  • removed: variable highlighter
  • removed: variable pp
  • removed: variable t
  • removed: class Console(BaseConsole)
  • removed: constructor Console(**kwargs) -> None
  • removed: method Console.is_terminal() -> bool
  • removed: method Console.print(*objects: Any, sep=…, end=…, file: IO[str]=…, style: Union[str, Style]=…, emoji: bool=…, markup: bool=…, highlight: bool=…, flush: bool=…) -> JupyterRenderable
  • removed: variable console
  • removed: variable print
  • changed: constructor JupyterRenderable(text: str, html: str) -> None → constructor JupyterRenderable(html: str) -> None
  • added: class JupyterMixin
  • added: function display(segments: Iterable[Segment]) -> None
  • added: function print(*args, **kwargs) -> None
  • added: static method JupyterRenderable.render(rich_renderable: RenderableType) -> str
  • removed: variable bars
  • removed: variable console
  • removed: variable refresh
  • removed: variable table
  • added: method LiveRender.position_cursor() -> Control
  • removed: variable markup
  • removed: variable md
  • changed: class Markdown → class Markdown(JupyterMixin)
  • changed: constructor Markdown(markup: str, code_theme: str=…, justify: JustifyValues=…, style: Union[str, Style]=…) -> None → constructor Markdown(markup: str, code_theme: str=…, justify: JustifyValues=…, style: Union[str, Style]=…, hyperlinks: bool=…) -> None
  • added: class ImageItem(TextElement)
  • added: constructor ImageItem(destination: str, hyperlinks: bool) -> None
  • added: field ImageItem.new_line
  • added: method ImageItem.on_enter(context: MarkdownContext) -> None
  • added: static method ImageItem.create(markdown: Markdown, node: Any) -> MarkdownElement
  • added: variable args
  • added: variable parser
  • added: class Tag(NamedTuple)
  • added: field Tag.name: str
  • added: field Tag.parameters: Optional[str]
  • added: function escape(markup: str) -> str
  • added: property Tag.markup -> str
  • added: variable console
  • changed: class Padding → class Padding(JupyterMixin)
  • changed: constructor Padding(renderable: RenderableType, pad: PaddingDimensions, *, style: Union[str, Style]=…) → constructor Padding(renderable: RenderableType, pad: PaddingDimensions=…, *, style: Union[str, Style]=…)
  • changed: static method Padding.indent(renderable: RenderableType, pad_amount: int) -> Padding → static method Padding.indent(renderable: RenderableType, level: int) -> Padding
  • changed: class Panel → class Panel(JupyterMixin)
  • changed: constructor Panel(renderable: RenderableType, box: box.Box=…, expand: bool=…, style: Union[str, Style]=…, width: Optional[int]=…) -> None → constructor Panel(renderable: RenderableType, box: Box=…, expand: bool=…, style: Union[str, Style]=…, width: Optional[int]=…, padding: PaddingDimensions=…) -> None
  • changed: constructor Progress(*columns: Union[str, ProgressColumn], console: Console=…, auto_refresh: bool=…, refresh_per_second: int=…, speed_estimate_period: float=…) -> None → constructor Progress(*columns: Union[str, ProgressColumn], console: Console=…, auto_refresh: bool=…, refresh_per_second: int=…, speed_estimate_period: float=…, get_time: GetTimeCallable=…) -> None
  • changed: function track(sequence: Union[Sequence[ProgressType], Iterable[ProgressType]], description=…, total: int=…, auto_refresh=…) -> Iterable[ProgressType] → function track(sequence: Union[Sequence[ProgressType], Iterable[ProgressType]], description=…, total: int=…, auto_refresh=…, console: Optional[Console]=…, get_time: Callable[[], float]=…) -> Iterable[ProgressType]
  • added: class TextColumn(ProgressColumn)
  • added: constructor TextColumn(text_format: str, style: StyleType=…, justify: JustifyValues=…, markup: bool=…, highlighter: Highlighter=…) -> None
  • added: method Progress.get_renderable() -> RenderableType
  • added: method Progress.get_renderables() -> Iterable[RenderableType]
  • added: method Progress.log(*objects: Any, sep=…, end=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…, log_locals: bool=…, _stack_offset=…) -> None
  • added: method Progress.make_tasks_table(tasks: Iterable[Task]) -> Table
  • added: method Progress.print(*objects: Any, sep=…, end=…, style: Union[str, Style]=…, justify: JustifyValues=…, emoji: bool=…, markup: bool=…, highlight: bool=…) -> None
  • added: method Task.get_time() -> float
  • added: method TextColumn.render(task: Task)
  • added: property Progress.tasks -> List[Task]
  • added: property Task.started -> bool
  • added: variable GetTimeCallable
  • added: variable examples
  • added: variable progress_renderables
  • added: variable syntax
  • added: variable table
  • changed: class Rule → class Rule(JupyterMixin)
  • added: field Segment.is_control: bool
  • added: property Segment.cell_length -> int
  • added: static method Segment.control(text: str) -> Segment
  • added: static method Segment.filter_control(segments: Iterable[Segment], is_control=…) -> Iterable[Segment]
  • added: static method Segment.split_lines(segments: Iterable[Segment]) -> Iterable[List[Segment]]
  • changed: constructor Style(*, color: Union[Color, str]=…, bgcolor: Union[Color, str]=…, bold: bool=…, dim: bool=…, italic: bool=…, underline: bool=…, blink: bool=…, blink2: bool=…, reverse: bool=…, conceal: bool=…, strike: bool=…) → constructor Style(*, color: Union[Color, str]=…, bgcolor: Union[Color, str]=…, bold: bool=…, dim: bool=…, italic: bool=…, underline: bool=…, blink: bool=…, blink2: bool=…, reverse: bool=…, conceal: bool=…, strike: bool=…, underline2: bool=…, frame: bool=…, encircle: bool=…, overline: bool=…, link: str=…)
  • changed: method Style.render(text: str=…, *, color_system: Optional[ColorSystem]=…, __STYLE_TABLE=…) -> str → method Style.render(text: str=…, *, color_system: Optional[ColorSystem]=…) -> str
  • added: field Style.encircle
  • added: field Style.frame
  • added: field Style.overline
  • added: field Style.underline2
  • added: property Style.link -> Optional[str]
  • added: property StyleStack.current -> Style
  • changed: class Syntax → class Syntax(JupyterMixin)
  • added: variable args
  • added: variable parser
  • changed: class Table → class Table(JupyterMixin)
  • changed: constructor Table(*headers: Union[Column, str], title: Union[str, Text]=…, caption: Union[str, Text]=…, width: int=…, box: Optional[box.Box]=…, padding: PaddingDimensions=…, 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: StyleType=…, b… → 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…
  • changed: static method Table.grid(padding: PaddingDimensions=…) -> Table → static method Table.grid(padding: PaddingDimensions=…, collapse_padding: bool=…, pad_edge: bool=…) -> Table
  • removed: property Text.text -> str
  • changed: class Text → class Text(JupyterMixin)
  • changed: constructor Text(text: str=…, style: Union[str, Style]=…, justify: JustifyValues=…, end: str=…, tab_size: Optional[int]=…) -> None → constructor Text(text: str=…, style: Union[str, Style]=…, justify: JustifyValues=…, end: str=…, tab_size: Optional[int]=…, spans: List[Span]=…) -> None
  • changed: method Text.highlight_regex(re_highlight: str, style: Union[str, Style]=…) -> int → method Text.highlight_regex(re_highlight: str, style: Union[str, Style]=…, style_prefix: str=…) -> int
  • changed: method Text.wrap(width: int, justify: JustifyValues=…, tab_size: int=…) -> Lines → method Text.wrap(console: Console, width: int, justify: JustifyValues=…, tab_size: int=…) -> Lines
  • changed: static method Text.assemble(*parts: Tuple[str, Union[str, Style]], 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: JustifyValues=…, end: str=…, tab_size: int=…) -> Text
  • added: method Text.copy_styles(text: Text) -> None
  • added: method Text.get_style_at_offset(console: Console, offset: int) -> Style
  • added: method Text.stylize_all(style: Union[str, Style]) -> None
  • added: property Text.plain -> str
  • changed: constructor Theme(styles: Dict[str, Style]=…, inherit: bool=…) → constructor Theme(styles: Mapping[str, StyleType]=…, inherit: bool=…)
  • added: variable console
  • added: variable theme