You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using rich.pretty, the builtin %pprint command results in a traceback
%pprint is intended to toggle on and off the pretty printing, something which is not supported by Rich in general.
To Reproduce
In [1]: from rich import pretty
In [2]: pretty.install()
In [3]: %pprint
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
... (lines removed)
306 """Toggle pretty printing on/off."""
307 ptformatter = self.shell.display_formatter.formatters['text/plain']
--> 308 ptformatter.pprint = bool(1 - ptformatter.pprint)
309 print('Pretty printing has been turned',
310 ['OFF','ON'][ptformatter.pprint])
AttributeError: 'BaseFormatter' object has no attribute 'pprint'
Possible solutions
Ideal solution: rich.pretty supports %pprint
Next best solution: Attempting to use %pprint with rich.pretty results in a message indicating that this is not supported
Minimal solution: A note is added in the documentation about this feature not being supported and a message is printed
when pretty is installed inside IPython.
Platform
Windows 10; Windows Terminal
Diagnose
rich==10.12.0
ipython==7.25.0
The text was updated successfully, but these errors were encountered:
I believe that adding the following would work as a minimal implementation:
fromIPython.core.magicimportregister_line_cell_magic@register_line_cell_magicdefpprint(_line=None, _cell=None):
print("%pprint is not supported by Rich.")
Describe the bug
When using rich.pretty, the builtin %pprint command results in a traceback
%pprint is intended to toggle on and off the pretty printing, something which is not supported by Rich in general.
To Reproduce
Possible solutions
when pretty is installed inside IPython.
Platform
Windows 10; Windows Terminal
Diagnose
rich==10.12.0
ipython==7.25.0
The text was updated successfully, but these errors were encountered: