Calmcode - rich: traceback

Better tracebacks in Python via Rich.

1 2 3 4 5 6 7 8 9 10 11 12

You can get a much better developer experience by using the rich traceback feature. It makes it much more easthetically pleasing and will also make bug-finding a less painful experience.

import time
from rich.console import Console
from rich.traceback import install
install()

def add_two(n1, n2):
    console.log("About to add two numbers.", log_locals=True)
    return n1 + n2

console = Console()
for i in range(10):
    time.sleep(0.2)
    add_two(1, i)
add_two(1, 'a')