Skip to content

Commit 74445d7

Browse files
committed
Merge branch 'master' of https://github.com/chthollyphile/rich
2 parents 0d45a34 + fb00932 commit 74445d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+805
-335
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
# Initializes the CodeQL tools for scanning.
3535
- name: Initialize CodeQL
36-
uses: github/codeql-action/init@v2
36+
uses: github/codeql-action/init@v3
3737
with:
3838
languages: ${{ matrix.language }}
3939
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -47,7 +47,7 @@ jobs:
4747
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
4848
# If this step fails, then you should remove it and run the build manually (see below)
4949
- name: Autobuild
50-
uses: github/codeql-action/autobuild@v2
50+
uses: github/codeql-action/autobuild@v3
5151

5252
# ℹ️ Command-line programs to run using the OS shell.
5353
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -60,6 +60,6 @@ jobs:
6060
# ./location_of_script_within_repo/buildscript.sh
6161

6262
- name: Perform CodeQL Analysis
63-
uses: github/codeql-action/analyze@v2
63+
uses: github/codeql-action/analyze@v3
6464
with:
6565
category: "/language:${{matrix.language}}"

.github/workflows/pythonpackage.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ jobs:
88
strategy:
99
matrix:
1010
os: [windows-latest, ubuntu-latest, macos-latest]
11-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0", "3.12.0-rc.3"]
11+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
12+
include:
13+
- { os: ubuntu-latest, python-version: "3.7" }
14+
- { os: windows-latest, python-version: "3.7" }
15+
- { os: macos-12, python-version: "3.7" }
1216
defaults:
1317
run:
1418
shell: bash
1519
steps:
1620
- uses: actions/checkout@v4
1721
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
1923
with:
2024
python-version: ${{ matrix.python-version }}
21-
architecture: x64
2225
- name: Install and configure Poetry
2326
# TODO: workaround for https://github.com/snok/install-poetry/issues/94
24-
uses: snok/install-poetry@v1.3.3
27+
uses: snok/install-poetry@v1.3.4
2528
with:
2629
version: 1.3.1
2730
virtualenvs-in-project: true
@@ -41,7 +44,7 @@ jobs:
4144
source $VENV
4245
pytest tests -v --cov=./rich --cov-report=xml:./coverage.xml --cov-report term-missing
4346
- name: Upload code coverage
44-
uses: codecov/codecov-action@v3
47+
uses: codecov/codecov-action@v4
4548
with:
4649
token: ${{ secrets.CODECOV_TOKEN }}
4750
file: ./coverage.xml

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ repos:
3030
hooks:
3131
- id: pycln
3232
args: [--all]
33-
- repo: https://github.com/psf/black
34-
rev: 23.7.0
33+
- repo: https://github.com/psf/black-pre-commit-mirror
34+
rev: 23.11.0
3535
hooks:
3636
- id: black
3737
exclude: ^benchmarks/

CHANGELOG.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,34 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [13.7.1] - 2023-02-28
8+
9+
## Unreleased
10+
11+
### Fixed
12+
13+
- Fixed `Table` rendering of box elements so "footer" elements truly appear at bottom of table, "mid" elements in main table body.
14+
- Fixed styles in Panel when Text objects are used for title https://github.com/Textualize/rich/pull/3401
15+
- Fix pretty repr for `collections.deque` https://github.com/Textualize/rich/pull/2864
16+
- Thread used in progress.track will exit if an exception occurs in a generator https://github.com/Textualize/rich/pull/3402
17+
- Progress track thread is now a daemon thread https://github.com/Textualize/rich/pull/3402
18+
- Fixed cached hash preservation upon clearing meta and links https://github.com/Textualize/rich/issues/2942
19+
- Fixed overriding the `background_color` of `Syntax` not including padding https://github.com/Textualize/rich/issues/3295
20+
21+
### Changed
22+
23+
- `RichHandler` errors and warnings will now use different colors (red and yellow) https://github.com/Textualize/rich/issues/2825
24+
- Removed the empty line printed in jupyter while using `Progress` https://github.com/Textualize/rich/pull/2616
25+
- Running tests in environment with `FORCE_COLOR` or `NO_COLOR` environment variables
26+
- ansi decoder will now strip problematic private escape sequences (like `\x1b7`) https://github.com/Textualize/rich/pull/3278/
27+
- Tree's ASCII_GUIDES and TREE_GUIDES constants promoted to class attributes
28+
29+
### Added
30+
31+
- Adds a `case_sensitive` parameter to `prompt.Prompt`. This determines if the
32+
response is treated as case-sensitive. Defaults to `True`.
33+
34+
## [13.7.1] - 2024-02-28
35+
936

1037
### Fixed
1138

@@ -69,7 +96,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6996

7097
- Text.tab_size now defaults to `None` to indicate that Console.tab_size should be used.
7198

72-
7399
## [13.4.2] - 2023-06-12
74100

75101
### Changed
@@ -124,6 +150,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124150

125151
- Added Polish README
126152

153+
127154
### Changed
128155

129156
- `rich.progress.track()` will now show the elapsed time after finishing the task https://github.com/Textualize/rich/pull/2659

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
66
contributors and maintainers pledge to making participation in our project and
77
our community a harassment-free experience for everyone, regardless of age, body
88
size, disability, ethnicity, sex characteristics, gender identity and expression,
9-
level of experience, education, socio-economic status, nationality, personal
9+
level of experience, education, socioeconomic status, nationality, personal
1010
appearance, race, religion, or sexual identity and orientation.
1111

1212
## Our Standards

CONTRIBUTORS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,31 @@ The following people have contributed to the development of Rich:
1111
- [Robin Bowes](https://github.com/yo61)
1212
- [Dennis Brakhane](https://github.com/brakhane)
1313
- [Darren Burns](https://github.com/darrenburns)
14+
- [Ceyda Cinarel](https://github.com/cceyda)
1415
- [Jim Crist-Harif](https://github.com/jcrist)
1516
- [Ed Davis](https://github.com/davised)
1617
- [Pete Davison](https://github.com/pd93)
1718
- [James Estevez](https://github.com/jstvz)
19+
- [Jonathan Eunice](https://github.com/jonathan-3play)
1820
- [Aryaz Eghbali](https://github.com/AryazE)
1921
- [Oleksis Fraga](https://github.com/oleksis)
2022
- [Andy Gimblett](https://github.com/gimbo)
23+
- [Tom Gooding](https://github.com/TomJGooding)
2124
- [Michał Górny](https://github.com/mgorny)
2225
- [Nok Lam Chan](https://github.com/noklam)
2326
- [Leron Gray](https://github.com/daddycocoaman)
2427
- [Andre Hora](https://github.com/andrehora)
2528
- [Kenneth Hoste](https://github.com/boegel)
2629
- [Lanqing Huang](https://github.com/lqhuang)
2730
- [Finn Hughes](https://github.com/finnhughes)
31+
- [Logan Hunt](https://github.com/dosisod)
32+
- [JP Hutchins](https://github.com/JPhutchins)
2833
- [Ionite](https://github.com/ionite34)
2934
- [Josh Karpel](https://github.com/JoshKarpel)
3035
- [Jan Katins](https://github.com/jankatins)
3136
- [Hugo van Kemenade](https://github.com/hugovk)
3237
- [Andrew Kettmann](https://github.com/akettmann)
38+
- [Alexander Krasnikov](https://github.com/askras)
3339
- [Martin Larralde](https://github.com/althonos)
3440
- [Hedy Li](https://github.com/hedythedev)
3541
- [Henry Mai](https://github.com/tanducmai)
@@ -49,6 +55,7 @@ The following people have contributed to the development of Rich:
4955
- [Kylian Point](https://github.com/p0lux)
5056
- [Kyle Pollina](https://github.com/kylepollina)
5157
- [Sebastián Ramírez](https://github.com/tiangolo)
58+
- [Grant Ramsay](https://github.com/seapagan)
5259
- [Felipe Guedes](https://github.com/guedesfelipe)
5360
- [Min RK](https://github.com/minrk)
5461
- [Clément Robert](https://github.com/neutrinoceros)
@@ -60,9 +67,11 @@ The following people have contributed to the development of Rich:
6067
- [Anthony Shaw](https://github.com/tonybaloney)
6168
- [Nicolas Simonds](https://github.com/0xDEC0DE)
6269
- [Aaron Stephens](https://github.com/aaronst)
70+
- [Karolina Surma](https://github.com/befeleme)
6371
- [Gabriele N. Tornetta](https://github.com/p403n1x87)
6472
- [Nils Vu](https://github.com/nilsvu)
6573
- [Arian Mollik Wasi](https://github.com/wasi-master)
74+
- [Jan van Wijk](https://github.com/jdvanwijk)
6675
- [Handhika Yanuar Pratama](https://github.com/theDreamer911)
6776
- [za](https://github.com/za)
6877
- [Motahhar Mokfi](https://github.com/motahhar)

FAQ.md

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,81 @@
11

22
# Frequently Asked Questions
3-
- [Why does emoji break alignment in a Table or Panel?](#why-does-emoji-break-alignment-in-a-table-or-panel)
4-
- [Why does content in square brackets disappear?](#why-does-content-in-square-brackets-disappear)
5-
- [python -m rich.spinner shows extra lines](#python--m-rich.spinner-shows-extra-lines)
63
- [How do I log a renderable?](#how-do-i-log-a-renderable)
7-
- [Strange colors in console output.](#strange-colors-in-console-output.)
4+
- [How do I render console markup in RichHandler?](#how-do-i-render-console-markup-in-richhandler)
5+
- [Natively inserted ANSI escape sequence characters break alignment of Panel.](#natively-inserted-ansi-escape-sequence-characters-break-alignment-of-panel)
6+
- [python -m rich.spinner shows extra lines.](#python--m-richspinner-shows-extra-lines)
7+
- [Rich is automatically installing traceback handler.](#rich-is-automatically-installing-traceback-handler)
8+
- [Strange colors in console output.](#strange-colors-in-console-output)
9+
- [Why does content in square brackets disappear?](#why-does-content-in-square-brackets-disappear)
10+
- [Why does emoji break alignment in a Table or Panel?](#why-does-emoji-break-alignment-in-a-table-or-panel)
811

9-
<a name="why-does-emoji-break-alignment-in-a-table-or-panel"></a>
10-
## Why does emoji break alignment in a Table or Panel?
12+
<a name="how-do-i-log-a-renderable"></a>
13+
## How do I log a renderable?
1114

12-
Certain emoji take up double space within the terminal. Unfortunately, terminals don't always agree how wide a given character should be.
15+
Python's logging module is designed to work with strings. Consequently you won't be able to log Rich renderables (Table, Tree, etc) by calling `logger.debug` or other similar method.
1316

14-
Rich has no way of knowing how wide a character will be on any given terminal. This can break alignment in containers like Table and Panel, where Rich needs to know the width of the content.
17+
You could use the [capture](https://rich.readthedocs.io/en/latest/console.html#capturing-output) API to convert the renderable to a string and log that. However I would advise against it.
1518

16-
There are also *multiple codepoints* characters, such as country flags, and emoji modifiers, which produce wildly different results across terminal emulators.
19+
Logging supports configurable back-ends, which means that a log message could go somewhere other than the terminal -- which may not correctly render the formatting and style produced by Rich.
1720

18-
Fortunately, most characters will work just fine. But you may have to avoid using the emojis that break alignment. You will get good results if you stick to emoji released on or before version 9 of the Unicode database,
21+
If you are only logging with a file-handler to stdout, then you probably don't need to use the logging module at all. Consider using [Console.log](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.log) which will render anything that you can print with Rich, with a timestamp.
1922

20-
<a name="why-does-content-in-square-brackets-disappear"></a>
21-
## Why does content in square brackets disappear?
23+
<a name="how-do-i-render-console-markup-in-richhandler"></a>
24+
## How do I render console markup in RichHandler?
2225

23-
Rich will treat text within square brackets as *markup tags*, for instance `"[bold]This is bold[/bold]"`.
26+
Console markup won't work anywhere else, other than `RichHandler` -- which is why they are disabled by default.
2427

25-
If you are printing strings with literally square brackets you can either disable markup, or escape your strings.
26-
See the docs on [console markup](https://rich.readthedocs.io/en/latest/markup.html) for how to do this.
28+
See the docs if you want to [enable console markup](https://rich.readthedocs.io/en/latest/logging.html#logging-handler) in the logging handler.
2729

28-
<a name="python--m-rich.spinner-shows-extra-lines"></a>
29-
## python -m rich.spinner shows extra lines
30+
<a name="natively-inserted-ansi-escape-sequence-characters-break-alignment-of-panel"></a>
31+
## Natively inserted ANSI escape sequence characters break alignment of Panel.
3032

31-
The spinner example is know to break on some terminals (Windows in particular).
33+
If you print ansi escape sequences for color and style you may find the output breaks your output.
34+
You may find that border characters in Panel and Table are in the wrong place, for example.
3235

33-
Some terminals don't display emoji with the correct width, which means Rich can't always align them accurately inside a panel.
36+
As a general rule, you should allow Rich to generate all ansi escape sequences, so it can correctly account for these invisible characters.
37+
If you can't avoid a string with escape codes, you can convert it to an equivalent `Text` instance with `Text.from_ansi`.
3438

35-
<a name="how-do-i-log-a-renderable"></a>
36-
## How do I log a renderable?
39+
<a name="python--m-richspinner-shows-extra-lines"></a>
40+
## python -m rich.spinner shows extra lines.
3741

38-
Python's logging module is designed to work with strings. Consequently you won't be able to log Rich renderables (Table, Tree, etc) by calling `logger.debug` or other similar method.
42+
The spinner example is know to break on some terminals (Windows in particular).
3943

40-
You could use the [capture](https://rich.readthedocs.io/en/latest/console.html#capturing-output) API to convert the renderable to a string and log that. However I would advise against it.
44+
Some terminals don't display emoji with the correct width, which means Rich can't always align them accurately inside a panel.
4145

42-
Logging supports configurable back-ends, which means that a log message could go somewhere other than the terminal -- which may not correctly render the formatting and style produced by Rich.
46+
<a name="rich-is-automatically-installing-traceback-handler"></a>
47+
## Rich is automatically installing traceback handler.
4348

44-
If you are only logging with a file-handler to stdout, then you probably don't need to use the logging module at all. Consider using [Console.log](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.log) which will render anything that you can print with Rich, with a timestamp.
49+
Rich will never install the traceback handler automatically.
50+
51+
If you are getting Rich tracebacks and you don't want them, then some other piece of software is calling `rich.traceback.install()`.
4552

46-
<a name="strange-colors-in-console-output."></a>
53+
<a name="strange-colors-in-console-output"></a>
4754
## Strange colors in console output.
4855

4956
Rich will highlight certain patterns in your output such as numbers, strings, and other objects like IP addresses.
5057

5158
Occasionally this may also highlight parts of your output you didn't intend. See the [docs on highlighting](https://rich.readthedocs.io/en/latest/highlighting.html) for how to disable highlighting.
5259

60+
<a name="why-does-content-in-square-brackets-disappear"></a>
61+
## Why does content in square brackets disappear?
62+
63+
Rich will treat text within square brackets as *markup tags*, for instance `"[bold]This is bold[/bold]"`.
64+
65+
If you are printing strings with literally square brackets you can either disable markup, or escape your strings.
66+
See the docs on [console markup](https://rich.readthedocs.io/en/latest/markup.html) for how to do this.
67+
68+
<a name="why-does-emoji-break-alignment-in-a-table-or-panel"></a>
69+
## Why does emoji break alignment in a Table or Panel?
70+
71+
Certain emoji take up double space within the terminal. Unfortunately, terminals don't always agree how wide a given character should be.
72+
73+
Rich has no way of knowing how wide a character will be on any given terminal. This can break alignment in containers like Table and Panel, where Rich needs to know the width of the content.
74+
75+
There are also *multiple codepoints* characters, such as country flags, and emoji modifiers, which produce wildly different results across terminal emulators.
76+
77+
Fortunately, most characters will work just fine. But you may have to avoid using the emojis that break alignment. You will get good results if you stick to emoji released on or before version 9 of the Unicode database,
78+
5379
<hr>
5480

5581
Generated by [FAQtory](https://github.com/willmcgugan/faqtory)

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ See what [people are saying about Rich](https://www.willmcgugan.com/blog/pages/p
3939

4040
## Compatibility
4141

42-
Rich works with Linux, OSX, and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.7 or later.
42+
Rich works with Linux, macOS and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.7 or later.
4343

4444
Rich works with [Jupyter notebooks](https://jupyter.org/) with no additional configuration required.
4545

@@ -437,11 +437,3 @@ See also [Rich CLI](https://github.com/textualize/rich-cli) for a command line a
437437
See also Rich's sister project, [Textual](https://github.com/Textualize/textual), which you can use to build sophisticated User Interfaces in the terminal.
438438

439439
![Textual screenshot](https://raw.githubusercontent.com/Textualize/textual/main/imgs/textual.png)
440-
441-
# Projects using Rich
442-
443-
For some examples of projects using Rich, see the [Rich Gallery](https://www.textualize.io/rich/gallery) on [Textualize.io](https://www.textualize.io).
444-
445-
Would you like to add your own project to the gallery? You can! Follow [these instructions](https://www.textualize.io/gallery-instructions).
446-
447-
<!-- This is a test, no need to translate -->

0 commit comments

Comments
 (0)