From 7b851516cba7ea1ea08db1af0507996303040294 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 8 Jan 2022 11:55:12 +0000 Subject: [PATCH 1/2] rendergroup --- CHANGELOG.md | 5 ++++- rich/console.py | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abe01b9d0..76a9f528f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - ## [11.0.0] - Unreleased ### Added @@ -14,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added max_depth arg to pretty printing - Fix Traceback theme defaults override user supplied styles https://github.com/Textualize/rich/issues/1786 +### Changed + +- **breaking** Deprecated rich.console.RenderGroup, now named rich.console.Group + ## [10.16.2] - 2021-01-02 ### Fixed diff --git a/rich/console.py b/rich/console.py index b6a661061..6fdc7403f 100644 --- a/rich/console.py +++ b/rich/console.py @@ -11,9 +11,9 @@ from html import escape from inspect import isclass from itertools import islice -from time import monotonic from threading import RLock -from types import FrameType, TracebackType, ModuleType +from time import monotonic +from types import FrameType, ModuleType, TracebackType from typing import ( IO, TYPE_CHECKING, @@ -258,11 +258,12 @@ def __rich_console__( ... +# A type that may be rendered by Console. RenderableType = Union[ConsoleRenderable, RichCast, str] -"""A type that may be rendered by Console.""" + +# The result of calling a __rich_console__ method. RenderResult = Iterable[Union[RenderableType, Segment]] -"""The result of calling a __rich_console__ method.""" _null_highlighter = NullHighlighter() @@ -475,9 +476,6 @@ def __rich_console__( yield from self.renderables -RenderGroup = Group # TODO: deprecate at some point - - def group(fit: bool = True) -> Callable[..., Callable[..., Group]]: """A decorator that turns an iterable of renderables in to a group. @@ -488,7 +486,7 @@ def group(fit: bool = True) -> Callable[..., Callable[..., Group]]: def decorator( method: Callable[..., Iterable[RenderableType]] ) -> Callable[..., Group]: - """Convert a method that returns an iterable of renderables in to a RenderGroup.""" + """Convert a method that returns an iterable of renderables in to a Group.""" @wraps(method) def _replace(*args: Any, **kwargs: Any) -> Group: From ad9debf2eb5a04cea709d35a7bc03f316bf0431c Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 8 Jan 2022 13:08:59 +0000 Subject: [PATCH 2/2] remove render_group --- rich/console.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/rich/console.py b/rich/console.py index 6fdc7403f..fbf87bd5c 100644 --- a/rich/console.py +++ b/rich/console.py @@ -498,9 +498,6 @@ def _replace(*args: Any, **kwargs: Any) -> Group: return decorator -render_group = group - - def _is_jupyter() -> bool: # pragma: no cover """Check if we're running in a Jupyter notebook.""" try: