rich

Rich is a Python library for rich text and beautiful formatting in the terminal.

MIT License

Downloads
241.8M
Stars
48.1K
Committers
268

Bot releases are hidden (Show)

rich -

Published by willmcgugan almost 4 years ago

[9.3.0] - 2020-12-1

### Added

  • Added get_datetime parameter to Console, to allow for repeatable tests
  • Added get_time parameter to Console
  • Added rich.abc.RichRenderable
  • Added expand_all to rich.pretty.install()
  • Added locals_max_length, and locals_max_string to Traceback and logging.RichHandler
  • Set defaults of max_length and max_string for Traceback to 10 and 80
  • Added disable argument to Progress

Changed

  • Reformatted test card (python -m rich)

Fixed

rich -

Published by willmcgugan almost 4 years ago

[9.2.0] - 2020-11-08

Added

  • Added tracebacks_show_locals parameter to RichHandler
  • Added max_string to Pretty
  • Added rich.ansi.AnsiDecoder
  • Added decoding of ansi codes to captured stdout in Progress
  • Added expand_all to rich.pretty.pprint

Changed

  • Applied dim=True to indent guide styles
  • Factored out RichHandler.get_style_and_level to allow for overriding in subclasses
  • Hid progress bars from html export
  • rich.pretty.pprint now soft wraps
rich -

Published by willmcgugan almost 4 years ago

The highlight of this version is the new option to render 'indent guides' in Syntax and pretty printing.

I've also added a max_length argument to pretty printing which will truncate containers longer than a certain length.

[9.1.0] - 2020-10-23

Added

  • Added Text.with_indentation_guide
  • Added Text.detect_indentation
  • Added Pretty.indent_guides
  • Added Syntax.indent_guides
  • Added indent_guides parameter on pretty.install
  • Added rich.pretty.pprint
  • Added max_length to Pretty

Changed

  • Enabled indent guides on Tracebacks

Fixed

rich -

Published by willmcgugan about 4 years ago

[9.0.1] - 2020-10-19

Fixed

rich - Paging Dr Rich

Published by willmcgugan about 4 years ago

The highlights of Rich 9.0.0 would be a new pager method which will pipe any console output in to the system 'pager'. See this tweet for an example. There's also a new Bar renderable you could use to display a chart in a table. See bars.py for an example of how to use it.

Note this is a major version release so there are some breaking changes to the API -- these are unlikely to impact many people, but please check the changelog below.

[9.0.0] - 2020-10-18

Fixed

  • Progress download column now displays decimal units

Added

  • Support for Python 3.9
  • Added legacy_windows to ConsoleOptions
  • Added ascii_only to ConsoleOptions
  • Added box.SQUARE_DOUBLE_HEAD
  • Added highlighting of EUI-48 and EUI-64 (MAC addresses)
  • Added Console.pager
  • Added Console.out
  • Added binary_units in progress download column
  • Added Progress.reset
  • Added Style.background_style property
  • Added Bar renderable https://github.com/willmcgugan/rich/pull/361
  • Added Table.min_width
  • Added table.Column.min_width and table.Column.max_width, and same to Table.add_column

Changed

  • Dropped box.get_safe_box function in favor of Box.substitute
  • Changed default padding in Panel from 0 to (0, 1) https://github.com/willmcgugan/rich/issues/385
  • Table with row_styles will extend background color between cells if the box has no vertical dividerhttps://github.com/willmcgugan/rich/issues/383
  • Changed default of fit kwarg in render_group() from False to True
  • Renamed rich.bar to rich.progress_bar, and Bar class to ProgressBar, rich.bar is now the new solid bar class

Fixed

  • Fixed typo in Style.transparent_background method name.
rich - Locals in tracebacks

Published by willmcgugan about 4 years ago

The highlight of this release is the option to show local variables in tracebacks.

[8.0.0] - 2020-10-03

### Added

  • Added Console.bell method
  • Added Set to types that Console.print will automatically pretty print
  • Added show_locals to Traceback
  • Added theme stack mechanism, see Console.push_theme and Console.pop_theme

Changed

  • Changed Style.empty to Style.null to better reflect what it does
  • Optimized combining styles involving a null style
  • Change error messages in Style.parse to read better

Fixed

  • Fixed Table.__rich_measure__
  • Fixed incorrect calculation of fixed width columns
rich - Better traceback formatting

Published by willmcgugan about 4 years ago

The highlight of this release is some improvements to Rich tracebacks. The traceback display makes better use of space and handle long paths better. Rich tracebacks can also be rendered in Rich's logging handler which is much easier to read (thanks to @taliraj for his PR for this feature).

[7.1.0] - 2020-09-26

Added

### Changed

  • Improved formatting of exceptions
  • Enabled Rich exceptions in logging https://github.com/taliraj
  • UTF-8 encoding is now mentioned in HTML head section

Removed

  • Removed line_numbers argument from traceback.install, which was undocumented and did nothing
rich - Syntax improvements

Published by willmcgugan about 4 years ago

The main feature of this release was a way of display syntax highlighting with only standard colors (i.e. the colors you can configure in the terminal), which you can do by setting the theme to "ansi_dark" or "ansi_light". The other themes are generally prettier (IMHO) but use colors defined by the theme, and not by the user's settings.

When testing the above I also made some optimizations which benefit all the Rich output. You may only notice this if you are syntax highlighting large XML files, but its faster now.

This is a major release as there were a small number of signature changes. Most people won't be impacted, but please review the release notes below.

[7.0.0] - 2020-09-18

Added

  • New ansi_dark and ansi_light themes
  • Added Text.append_tokens for fast appending of string + Style pairs
  • Added Text.remove_suffix
  • Added Text.append_tokens

### Changed

  • Text.tabs_to_spaces was renamed to Text.expand_tabs, which works in place rather than returning a new instance
  • Renamed Column.index to Column._index
  • Optimized Style.combine and Style.chain
  • Optimized text rendering by fixing internal cache mechanism
  • Optimized hash generation for Styles
rich - Highlight inline code in Markdown

Published by willmcgugan about 4 years ago

[6.2.0] - 2020-09-13

Added

  • Added inline code highlighting to Markdown
rich - Highlighting for IP addresses

Published by willmcgugan about 4 years ago

[6.1.2] - 2020-09-11

Added

  • Added ipv4 and ipv6 to ReprHighlighter

Changed

  • The # sign is included in url highlighting

Fixed

  • Fixed force-color switch in rich.syntax and rich.markdown commands
rich -

Published by willmcgugan about 4 years ago

A tiny change to 6.1.0

Inspect now adds def to signature of methods. Not strictly necessary, but I think it helps distinguish methods from data.

[6.1.1] - 2020-09-07

Changed

  • Restored "def" in inspect signature
rich -

Published by willmcgugan about 4 years ago

This release adds a function called inspect which uses rich to display the data / methods / docs for any Python object.

I think this is a fantastic debug aid, and I'm looking forward to using it in other projects.

[6.1.0] - 2020-09-07

Added

  • New inspect module
  • Added os._Environ to pretty print

Fixed

  • Prevented recursive renderables from getting stuck

Changed

  • force_terminal and force_jupyter can now be used to force the disabled state, or left as None to auto-detect.
  • Panel now expands to fit title if supplied
rich - A pretty good release

Published by willmcgugan about 4 years ago

Headline of this release is a better pretty print. The previous version could expand lines prematurely. This version fits containers and is faster to boot. It also support defaultdict, Counter, and array.

Breaking change is because the signature of Pretty and pretty_repr has changed, and the character argument to rule was dropped. This is unlikely to impact many people.

[6.0.0] - 2020-08-25

Fixed

  • Fixed use of __rich__ cast

Changed

  • New algorithm to pretty print which fits more on a line if possible
  • Deprecated character parameter in Rule and Console.rule, in favor of characters
  • Optimized Syntax.from_path to avoid searching all lexers, which also speeds up tracebacks

Added

  • Added soft_wrap flag to Console.print
rich -

Published by willmcgugan about 4 years ago

[5.2.1] - 2020-08-19

rich - This release Rules

Published by willmcgugan about 4 years ago

Version 5.20 adds the ability to disable cropping to the console width, in effect allowing the terminal to soft wrap lines.

Also in 5.20 is the ability to specify multiple characters in a Rule.

[5.2.0] - 2020-08-14

rich - Pretty formatter optimizations

Published by willmcgugan about 4 years ago

[5.1.2] - 2020-08-10

Fixed

  • Further optimized pretty printing ~5X.

[5.1.1] - 2020-08-09

Fixed

  • Optimized pretty printing ~3X faster
rich - Rich REPL

Published by willmcgugan about 4 years ago

This release adds a home grown pretty print formatter, and removes the pprintpp dependancy. The new formatter is better integrated with Rich and will be a more flexible solution, but its not as battle tested as pprintpp. Please report any bugs!

Also in 5.1.0 is a 'display hook' which allows for integration of Rich in to the REPL, so all your data will be pretty. It's kind of fun to use.

The following will install the display hook.

>>> from rich import pretty
>>> pretty.install()

[5.1.0] - 2020-08-08

Added

Fixed

Changed

  • Implemented pretty printing, and removed pprintpp from dependencies
  • Optimized Text.join
rich - Markup format change

Published by willmcgugan about 4 years ago

Console markup syntax has been tweaked to not overlap with Python data structures.

Prior to 5.0.0 if you stringified a list it would typically be removed from the output as Rich would interpret it as a markup tag. This surprised people when printing lists in an f-string.

For instance, prior to 5.0.0 the following would not print as you might expect:

>>> my_list = [1,2,3]
>>> print(f"my_list={my_list}")
my_list=

With 5.0.0 it prints this following::

my_list = [1, 2, 3]

Which is less astonishing.

This change required some changes to the console markup syntax, which is the reason for the major version bump.

You can no longer use a number between 0 and 255 to provide a color, now it must be wrapped with color(NUMBER). So "[4]Red[/]" becomes "[color(4)]Red[/]". From an extensive search of Github, most people never used this syntax anyway and would prefer to use friendly color names.

Additionally escaping has changed. Prior to 5.0.0 you could escape square brackets by doubling them up. From 5.0.0 you can escape a tag with backslash.

[5.0.0] - 2020-08-02

Changed

  • Change to console markup syntax to not parse Python structures as markup, i.e. [1,2,3] is treated as a literal, not a tag.
  • Standard color numbers syntax has changed to "color(<number>)" so that [5] (for example) is considered a literal.
  • Markup escape method has changed from double brackets to preceding with a backslash, so foo[[]] would be foo\[bar]
rich -

Published by willmcgugan about 4 years ago

[4.2.1] - 2020-07-29

Added

Fixed

Changed

rich - Better 16 color rendering

Published by willmcgugan about 4 years ago

[4.2.0] - 2020-07-27

Fixed

Package Rankings
Top 0.25% on Pypi.org
Top 5.24% on Proxy.golang.org
Top 1.85% on Conda-forge.org
Top 7.68% on Anaconda.org
Badges
Extracted from project README
Downloads PyPI version codecov Rich blog Twitter Follow