Upgrading rich 11 to 12
Breaking11.2.0 → 12.6.0Breaking2Platform1Deprecated1New17Changed20Fixed40Other1
BreakingUpgrade verdict
2 breaking changes and a platform requirement change.
In plain terms
- Removes rich._lru_cache.
- The old tabulate helper is gone; use the Table class instead.
- You need at least Python 3.6.3 to install and use this version.
- The AlignValues name is deprecated; use AlignMethod instead.
Must act 4 items need code or config changes
Python requirement changed in 12.2.0: >=3.6.2,<4.0.0 → >=3.6.3,<4.0.0.
Drops colorama.
Installs 2 packages in all (was 3).
What you must change
Breaking2
Removes rich._lru_cache.
rich._lru_cacheRemoves rich.tabulate, which was marked for deprecation.
rich.tabulatePlatform1
Bumps the minimum Python version to 3.6.3.
Deprecations to plan for
Deprecated1
Deprecates rich.align.AlignValues in favor of AlignMethod.
rich.align.AlignValuesAlignMethodAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- added:
function print_json(json: Optional[str]=…, *, data: Any=…, indent: Union[None, int, str]=…, highlight: bool=…, skip_keys: bool=…, ensure_ascii: bool=…, check_circular: bool=…, allow_nan: bool=…, default: Optional[Callable[[Any], Any]]=…, sort_keys: bool=…) -> None
- removed:
variable AlignValues
- removed:
variable re_csi
- added:
method Box.get_plain_headed_box() -> Box - added:
variable MARKDOWN: Box - added:
variable PLAIN_HEADED_SUBSTITUTIONS
- changed:
function cell_len(text: str, _cache: Dict[str, int]=…) -> int → function cell_len(text: str, _cell_len: Callable[[str], int]=…) -> int - added:
function cached_cell_len(text: str) -> int
- removed:
variable CONSOLE_HTML_FORMAT - added:
method Console.export_svg(*, title: str=…, theme: Optional[TerminalTheme]=…, clear: bool=…, code_format: str=…, font_aspect_ratio: float=…, unique_id: Optional[str]=…) -> str - added:
method Console.save_svg(path: str, *, title: str=…, theme: Optional[TerminalTheme]=…, clear: bool=…, code_format: str=…, font_aspect_ratio: float=…, unique_id: Optional[str]=…) -> None - added:
method Console.set_window_title(title: str) -> bool - added:
method ConsoleOptions.reset_height() -> ConsoleOptions - added:
variable JUPYTER_DEFAULT_COLUMNS - added:
variable JUPYTER_DEFAULT_LINES
- changed:
variable STRIP_CONTROL_CODES → variable STRIP_CONTROL_CODES: Final - added:
function escape_control_codes(text: str, _translate_table: Dict[int, str]=…) -> str - added:
static method Control.title(title: str) -> Control - added:
variable CONTROL_ESCAPE: Final - added:
variable console
- added:
class ISO8601Highlighter(RegexHighlighter) - added:
field ISO8601Highlighter.base_style - added:
field ISO8601Highlighter.highlights - added:
field JSONHighlighter.JSON_STR - added:
field JSONHighlighter.JSON_WHITESPACE - added:
method JSONHighlighter.highlight(text: Text) -> None
- changed:
constructor Layout(renderable: Optional[RenderableType]=…, *, name: Optional[str]=…, size: Optional[int]=…, minimum_size: int=…, ratio: int=…, visible: bool=…, height: Optional[int]=…) -> None → constructor Layout(renderable: Optional[RenderableType]=…, *, name: Optional[str]=…, size: Optional[int]=…, minimum_size: int=…, ratio: int=…, visible: bool=…) -> None
- added:
variable fileio
- changed:
function measure_renderables(console: Console, options: ConsoleOptions, renderables: Iterable[RenderableType]) -> Measurement → function measure_renderables(console: Console, options: ConsoleOptions, renderables: Sequence[RenderableType]) -> Measurement
- changed:
function install(console: Optional[Console]=…, overflow: OverflowMethod=…, crop: bool=…, indent_guides: bool=…, max_length: Optional[int]=…, max_string: Optional[int]=…, expand_all: bool=…) -> None → function install(console: Optional[Console]=…, overflow: OverflowMethod=…, crop: bool=…, indent_guides: bool=…, max_length: Optional[int]=…, max_string: Optional[int]=…, max_depth: Optional[int]=…, expand_all: bool=…) -> None - added:
class StockKeepingUnit(NamedTuple) - added:
class Thing - added:
field Node.is_namedtuple: bool - added:
field StockKeepingUnit.category: str - added:
field StockKeepingUnit.description: str - added:
field StockKeepingUnit.name: str - added:
field StockKeepingUnit.price: float - added:
field StockKeepingUnit.reviews: List[str] - added:
variable JUPYTER_CLASSES_TO_NOT_RENDER
- removed:
property Task.remaining -> float - changed:
field Task.total: float → field Task.total: Optional[float] - changed:
method Progress.add_task(description: str, start: bool=…, total: float=…, completed: int=…, visible: bool=…, **fields: Any) -> TaskID → method Progress.add_task(description: str, start: bool=…, total: Optional[float]=…, completed: int=…, visible: bool=…, **fields: Any) -> TaskID - added:
class MofNCompleteColumn(ProgressColumn) - added:
class TaskProgressColumn(TextColumn) - added:
constructor MofNCompleteColumn(separator: str=…, table_column: Optional[Column]=…) - added:
constructor TaskProgressColumn(text_format: str=…, text_format_no_percentage: str=…, style: StyleType=…, justify: JustifyMethod=…, markup: bool=…, highlighter: Optional[Highlighter]=…, table_column: Optional[Column]=…, show_speed: bool=…) -> None - added:
constructor TimeRemainingColumn(compact: bool=…, elapsed_when_finished: bool=…, table_column: Optional[Column]=…) - added:
function open(file: Union[str, PathLike[str], bytes], mode: Union[Literal['rt'], Literal['r']], buffering: int=…, encoding: Optional[str]=…, errors: Optional[str]=…, newline: Optional[str]=…, *, total: Optional[int]=…, description: str=…, auto_refresh: bool=…, console: Optional[Console]=…, transient: bool=…, get_time: Optional[Callable[[], float]]=…, refresh_per_second: float=…, style: StyleType=… - added:
function wrap_file(file: BinaryIO, total: int, *, description: str=…, auto_refresh: bool=…, console: Optional[Console]=…, transient: bool=…, get_time: Optional[Callable[[], float]]=…, refresh_per_second: float=…, style: StyleType=…, complete_style: StyleType=…, finished_style: StyleType=…, pulse_style: StyleType=…, disable: bool=…) -> ContextManager[BinaryIO] - added:
method MofNCompleteColumn.render(task: Task) -> Text - added:
method Progress.open(file: Union[str, PathLike[str], bytes], mode: Literal['rb'], buffering: int=…, encoding: Optional[str]=…, errors: Optional[str]=…, newline: Optional[str]=…, *, total: Optional[int]=…, task_id: Optional[TaskID]=…, description: str=…) -> BinaryIO | (file: Union[str, PathLike[str], bytes], mode: Union[Literal['r'], Literal['rt']], buffering: int=…, encoding: Optional[str]=…, err… - added:
method Progress.wrap_file(file: BinaryIO, total: Optional[int]=…, *, task_id: Optional[TaskID]=…, description: str=…) -> BinaryIO - added:
method TaskProgressColumn.render(task: Task) -> Text - added:
property Task.remaining -> Optional[float] - added:
static method TaskProgressColumn.render_speed(speed: Optional[float]) -> Text
- removed:
property ProgressBar.percentage_completed -> float - changed:
constructor ProgressBar(total: float=…, completed: float=…, width: Optional[int]=…, pulse: bool=…, style: StyleType=…, complete_style: StyleType=…, finished_style: StyleType=…, pulse_style: StyleType=…, animation_time: Optional[float]=…) → constructor ProgressBar(total: Optional[float]=…, completed: float=…, width: Optional[int]=…, pulse: bool=…, style: StyleType=…, complete_style: StyleType=…, finished_style: StyleType=…, pulse_style: StyleType=…, animation_time: Optional[float]=…) - added:
property ProgressBar.percentage_completed -> Optional[float]
- changed:
function auto(cls: Optional[T]) -> T | (*, angular: bool=…) -> Callable[[T], T] → function auto(cls: Optional[Type[T]]) -> Type[T] | (*, angular: bool=…) -> Callable[[Type[T]], Type[T]] - changed:
function rich_repr(cls: Optional[T]) -> T | (*, angular: bool=…) -> Callable[[T], T] → function rich_repr(cls: Optional[Type[T]]) -> Type[T] | (*, angular: bool=…) -> Callable[[Type[T]], Type[T]]
- added:
field ControlType.SET_WINDOW_TITLE
- changed:
constructor Syntax(code: str, lexer: Union[Lexer, str], *, theme: Union[str, SyntaxTheme]=…, dedent: bool=…, line_numbers: bool=…, start_line: int=…, line_range: Optional[Tuple[Optional[int], Optional[int]]]=…, highlight_lines: Optional[Set[int]]=…, code_width: Optional[int]=…, tab_size: int=…, word_wrap: bool=…, background_color: Optional[str]=…, indent_guides: bool=…) -> None → constructor Syntax(code: str, lexer: Union[Lexer, str], *, theme: Union[str, SyntaxTheme]=…, dedent: bool=…, line_numbers: bool=…, start_line: int=…, line_range: Optional[Tuple[Optional[int], Optional[int]]]=…, highlight_lines: Optional[Set[int]]=…, code_width: Optional[int]=…, tab_size: int=…, word_wrap: bool=…, background_color: Optional[str]=…, indent_guides: bool=…, padding: PaddingDimensions… - changed:
static method Syntax.from_path(path: str, encoding: str=…, lexer: Optional[Union[Lexer, str]]=…, theme: Union[str, SyntaxTheme]=…, dedent: bool=…, line_numbers: bool=…, line_range: Optional[Tuple[int, int]]=…, start_line: int=…, highlight_lines: Optional[Set[int]]=…, code_width: Optional[int]=…, tab_size: int=…, word_wrap: bool=…, background_color: Optional[str]=…, indent_guides: bool=…) -> Syntax → static method Syntax.from_path(path: str, encoding: str=…, lexer: Optional[Union[Lexer, str]]=…, theme: Union[str, SyntaxTheme]=…, dedent: bool=…, line_numbers: bool=…, line_range: Optional[Tuple[int, int]]=…, start_line: int=…, highlight_lines: Optional[Set[int]]=…, code_width: Optional[int]=…, tab_size: int=…, word_wrap: bool=…, background_color: Optional[str]=…, indent_guides: bool=…, padding:… - added:
method Syntax.stylize_range(style: StyleType, start: SyntaxPosition, end: SyntaxPosition) -> None - added:
variable NUMBERS_COLUMN_DEFAULT_PADDING - added:
variable SyntaxPosition
- added:
method Table.add_section() -> None
- removed:
function tabulate_mapping(mapping: Mapping[Any, Any], title: Optional[str]=…, caption: Optional[str]=…, title_justify: Optional[JustifyMethod]=…, caption_justify: Optional[JustifyMethod]=…) -> Table
- added:
variable DIMMED_MONOKAI - added:
variable MONOKAI - added:
variable NIGHT_OWLISH - added:
variable SVG_EXPORT_THEME
- changed:
static method Text.from_markup(text: str, *, style: Union[str, Style]=…, emoji: bool=…, emoji_variant: Optional[EmojiVariant]=…, justify: Optional[JustifyMethod]=…, overflow: Optional[OverflowMethod]=…) -> Text → static method Text.from_markup(text: str, *, style: Union[str, Style]=…, emoji: bool=…, emoji_variant: Optional[EmojiVariant]=…, justify: Optional[JustifyMethod]=…, overflow: Optional[OverflowMethod]=…, end: str=…) -> Text - added:
method Text.stylize_before(style: Union[str, Style], start: int=…, end: Optional[int]=…) -> None
- changed:
method Tree.add(label: RenderableType, *, style: Optional[StyleType]=…, guide_style: Optional[StyleType]=…, expanded: bool=…, highlight: bool=…) -> Tree → method Tree.add(label: RenderableType, *, style: Optional[StyleType]=…, guide_style: Optional[StyleType]=…, expanded: bool=…, highlight: Optional[bool]=…) -> Tree