bijij / pretty

A Python module for prettier (and far more useful) stack traces.

Home Page:https://docs.shiney.dev/pretty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Analyze Status Build Status Check Status Deploy Status Lint Status


ShineyDev/pretty

A Python module for prettier (and far more useful) stack traces.
source | documentation

Install

$ pip install --upgrade git+https://github.com/ShineyDev/pretty.git@main

Use

If you wish to hook pretty.traceback into all Python sessions, set the PYTHONPRETTYTRACEBACK environment variable to a truthy value.

$ export PYTHONPRETTYTRACEBACK=1

If you wish to hook pretty.traceback into a single Python session, call pretty.traceback.hook().

>>> import pretty
>>> pretty.traceback.hook()

If you wish to use a formatter directly, initialize a new PrettyTracebackFormatter or DefaultTracebackFormatter, or build your own implementation on TracebackFormatter.

>>> import pretty
>>>
>>> formatter = pretty.traceback.PrettyTracebackFormatter()
>>>
>>> try:
>>>     1 / 0
>>> except Exception as e:
>>>     formatter.print_current_exception()
Copyright 2020-present ShineyDev
Inspired by Qix-/better-exceptions.

About

A Python module for prettier (and far more useful) stack traces.

https://docs.shiney.dev/pretty

License:Apache License 2.0


Languages

Language:Python 100.0%