add optional Rich highlighting to interactive Python sessions

This commit is contained in:
Martin Sekera 2023-05-01 02:19:29 +02:00
parent 1e0545152a
commit 41b2199225

View file

@ -16,7 +16,15 @@ try:
except:
pass
# bpython gets broken by ANSI colors, so skip those
if type(__builtins__) != dict:
sys.ps1 = '\001\x1b[1;32m\002>>> \001\x1b[0m\002'
sys.ps2 = '\001\x1b[0;32m\002... \001\x1b[0m\002'
try:
import rich
import rich.traceback
rich.traceback.install()
import rich.pretty
rich.pretty.install()
from rich import inspect
except:
pass