Skip to main content

Tracebacks for Humans (and Machines)

Fixing bugs is easier with well formatted error messages. Console, HTML and JSON.

PyPI version Tests Coverage

TraceRite in Notebook/HTML and terminal TraceRite formats Python errors in Jupyter notebooks, in plain HTML, and in the terminal: rich variable inspection (left), plus syntax-error highlighting and compact terminal tracebacks (right).

Installation

Python scripts or REPL

pip install tracerite
import tracerite; tracerite.load()

Any error message after that call will be prettified. Handles any syntax errors and uncaught exceptions, even captures logging.exception (optionally).

IPython or Jupyter Notebook

%pip install tracerite
%load_ext tracerite

This enables tracebacks in text or HTML format depending on where you are running. Add to ~/.ipython/profile_default/startup/tracerite.ipy to make it load automatically for all your ipython and notebook sessions. Alternatively, put the two lines at the top of your notebook.

If you are using UV, consider running with your other dependencies:

uvx --with tracerite --with numpy jupyter lab

FastAPI

Add the extension loader at the top of your app module:

from tracerite import patch_fastapi; patch_fastapi()

This monkeypatches Starlette error handling and FastAPI routing to work with HTML tracebacks. Note: this runs regardless of whether you are in production mode or debug mode, so you might want to call that function only conditionally in the latter.

Sanic

Comes with TraceRite built in. HTML reports are available in debug mode, and console messages are always formatted by Tracerite.

Clarity in complex situations

What you see is always in the order it was executed

Exception chain comparison TraceRite renders complex exception chains in chronological order (left). The Python 3.15 built in traceback needs illustrative arrows to follow execution (right).

Context manager enter/exit

When a with or async with fails, the built in handling of Python 3.11 marks the whole block, and 3.12.9+ marks the initializing expression like it was the culprit (e.g. function call marked incorrectly). We bypass that logic and differentiate between (1) the expression failing, (2) entering and (3) exiting the block.

Context manager failure In cases 2 (left) and 3 (right) we mark the whole with statement but not the block, and emphasize the expression responsible (helpful when there are more than one). In case 3 we include the executed block body in context shown (up to 20 lines).

Features

  • Chronological order - Single timeline with the program entry point is at top, and the finally uncaught exception bottom.
  • Minimalistic output - Smart pruning to show only relevant pieces of information, excluding library internals where not relevant and avoiding any repetition.
  • ExceptionGroups - Full tracebacks of the subexceptions from exceptions that occurred in parallel execution.
  • Variable inspection - See the values of your variables in a pretty printed HTML format, Terminal or JSON-compatible machine-readable dict.
  • JSON output - Intermediady dict format is JSON-compatible, useful for machine processing and used by our HTML and TTY modules.
  • HTML output - Works in Jupyter, Colab, and web frameworks such as FastAPI and Sanic as the debug mode error handler.
  • TTY output - Colorful, formatted tracebacks for terminal applications and Python REPL.
  • Custom Styling - Theme with your colors by defining CSS variables or tty.COLORS.
  • Automatic dark mode - Saves your eyes.

ExceptionGroup in HTML and terminal Python 3.11+ concurrent execution errors with except* handling are shown clearly in both HTML and terminal output.

Documentation

For the public API — including HTML rendering, terminal output, and the machine-readable chain format returned by extract_chain — see the API documentation. For contributors, see the Development guide.

License

Public Domain or equivalent.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracerite-2.6.5.tar.gz (106.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracerite-2.6.5-py3-none-any.whl (112.4 kB view details)

Uploaded Python 3

File details

Details for the file tracerite-2.6.5.tar.gz.

File metadata

  • Download URL: tracerite-2.6.5.tar.gz
  • Upload date:
  • Size: 106.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tracerite-2.6.5.tar.gz
Algorithm Hash digest
SHA256 e9ee648cf556aa7dbf0298c822a58ce33f9658b927db900fab72f1742146b695
MD5 5de82480702cd6b722ea3b1be4f938e8
BLAKE2b-256 918a457a65a29a28cb6f64158746a065c314c4748d7664338bd529529845d940

See more details on using hashes here.

File details

Details for the file tracerite-2.6.5-py3-none-any.whl.

File metadata

  • Download URL: tracerite-2.6.5-py3-none-any.whl
  • Upload date:
  • Size: 112.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tracerite-2.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0de23ea33cede6a905448bf0bd5fa869c4d950d06a3595693eebe55e44070f15
MD5 6716049ee86c02a9ab29a8108e15cfed
BLAKE2b-256 7b73510b204e9543645031656e42b3e12b70ebc692facf0293700348ee27a35b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.6.5 This release

2 files

2.6.4

2 files

2.6.3

2 files

2.6.2

2 files

2.6.1

2 files

2.6.0

2 files

2.5.2

2 files

2.5.1

2 files

2.5.0

2 files

2.4.1

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page