diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9685a6f5a..b3511d304 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest, macos-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9"] defaults: run: shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a51855e..d4a0a53dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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). +## [10.2.2] - 2021-05-19 + +### Fixed + +- Fixed status not rendering console markup https://github.com/willmcgugan/rich/issues/1244 + ## [10.2.1] - 2021-05-17 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index c70a52f52..68cbe2a91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "rich" homepage = "https://github.com/willmcgugan/rich" documentation = "https://rich.readthedocs.io/en/latest/" -version = "10.2.1" +version = "10.2.2" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" authors = ["Will McGugan "] license = "MIT" @@ -18,6 +18,7 @@ classifiers = [ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Typing :: Typed" ] include = ["rich/py.typed"] diff --git a/rich/spinner.py b/rich/spinner.py index b3d9d9c0c..5b13b1e9b 100644 --- a/rich/spinner.py +++ b/rich/spinner.py @@ -34,7 +34,7 @@ def __init__( spinner = SPINNERS[name] except KeyError: raise KeyError(f"no spinner called {name!r}") - self.text = text + self.text = Text.from_markup(text) if isinstance(text, str) else text self.frames = cast(List[str], spinner["frames"])[:] self.interval = cast(float, spinner["interval"]) self.start_time: Optional[float] = None @@ -103,7 +103,7 @@ def update( speed (float, optional): Speed factor for animation. Defaults to None. """ if text: - self.text = text + self.text = Text.from_markup(text) if isinstance(text, str) else text if style: self.style = style if speed: diff --git a/tests/test_segment.py b/tests/test_segment.py index 60069afbc..3aa0cb11f 100644 --- a/tests/test_segment.py +++ b/tests/test_segment.py @@ -1,3 +1,5 @@ +import sys + from rich.segment import ControlType from rich.segment import Segment from rich.style import Style @@ -6,10 +8,16 @@ def test_repr(): assert repr(Segment("foo")) == "Segment('foo', None)" home = (ControlType.HOME, 0) - assert ( - repr(Segment("foo", None, [home])) - == "Segment('foo', None, [(, 0)])" - ) + if sys.version_info >= (3, 10): + assert ( + repr(Segment("foo", None, [home])) + == "Segment('foo', None, [(ControlType.HOME, 0)])" + ) + else: + assert ( + repr(Segment("foo", None, [home])) + == "Segment('foo', None, [(, 0)])" + ) def test_line(): diff --git a/tests/test_spinner.py b/tests/test_spinner.py index 28aac7fc0..5560f1daf 100644 --- a/tests/test_spinner.py +++ b/tests/test_spinner.py @@ -4,6 +4,7 @@ from rich.measure import Measurement from rich.rule import Rule from rich.spinner import Spinner +from rich.text import Text def test_spinner_create(): @@ -65,3 +66,9 @@ def test_rich_measure(): min_width, max_width = Measurement.get(console, console.options, spinner) assert min_width == 3 assert max_width == 5 + + +def test_spinner_markup(): + spinner = Spinner("dots", "[bold]spinning[/bold]") + assert isinstance(spinner.text, Text) + assert str(spinner.text) == "spinning"