Skip to content

Instantly share code, notes, and snippets.

@HubertReX
Created August 9, 2023 15:36
Show Gist options
  • Save HubertReX/f7d6edc35f5bdc58a58c7859c8c0e1c6 to your computer and use it in GitHub Desktop.
Save HubertReX/f7d6edc35f5bdc58a58c7859c8c0e1c6 to your computer and use it in GitHub Desktop.
python profile script to prettify printing and traceback using Rich lib
# https://textual.textualize.io/blog/2023/07/27/using-rich-inspect-to-interrogate-python-objects/
# pip install rich
# set PYTHONSTARTUP=c:\Users\user\.pythonrc
from functools import partial
from rich import inspect, pretty, print
from rich import traceback
help = partial(inspect, help=True)
pretty.install()
print("Hello [yellow]Hubert[/]")
traceback.install(
show_locals=False, width=150, locals_max_string=50
#, suppress=[datetime, path, glob]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment