skillfed

better-exceptions

Pretty and helpful exceptions, automatically

better-exceptions v0.3.3 589.5K downloads/30d#5,861 on PyPI4,720
License unclear Active released

What it is and what it does

better-exceptions hooks into Python's exception system to display tracebacks with syntax highlighting and local variable values inline, making it easier to understand what went wrong at a glance. It works by setting an environment variable and is designed to be transparent—once activated, all exceptions in your Python process are automatically formatted without code changes. The package depends only on colorama for terminal color support.

You can use it in regular scripts, the Python REPL (via `python -m better_exceptions`), unittest test runners (with a monkey patch), or Django applications (via middleware). Advanced usage allows disabling value truncation. The package is intended for development and debugging; the documentation explicitly warns against leaving the environment variable set in production to avoid leaking sensitive data in logs.

Use it for:

  • Interactive debugging in the Python REPL to see local variables and syntax-highlighted code context.
  • Development workflows where you want richer exception output without modifying application code.
  • Django projects where middleware integration provides formatted exceptions across the entire request lifecycle.
  • Unit test debugging to see better-formatted assertion failures and error context.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Formats Python exceptions with syntax highlighting and local variable inspection to make debugging easier, activated via an environment variable.

Yes, if you do development work in Python and want better exception visibility without code changes. The low install friction, active maintenance, and zero known vulnerabilities make it a safe addition to a development environment. Not necessary for production unless you explicitly want formatted exception logging, in which case be careful to disable the environment variable in production.

Install

better-exceptions on PyPI

pip

pip install better-exceptions

uv

uv add better-exceptions

poetry

poetry add better-exceptions

Installing better-exceptions

Before you install

Low install friction with a single lightweight dependency (colorama). Actively maintained as of July 2026, though the latest release was in January 2021.

License in practice

License treatment is unclear in the metadata; the description references MIT licensing, but this is not formally declared in the package metadata.

Quickstart

pip install better-exceptions
export BETTER_EXCEPTIONS=1
python -m better_exceptions

Requires the BETTER_EXCEPTIONS environment variable to be set; without it, exceptions display normally.

Verify before relying

  • Whether the package works with current Python versions (requires_python is unspecified in metadata).
  • Whether the MIT license claim in the description is the authoritative license for this package.

Package facts

License not declared (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — colorama
Maintenance actively maintained — 2,023 days since the last release
Last repo commit
First released
Downloads 589,528/month — #5,861 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: better_exceptions-0.3.3-py3-none-any.whl

Keywords: pretty, better, exceptions, exception, error, local, debug, debugging, locals

Tags

pretty print exceptionspython exception formattingdebug with local variablescolorized error outputbetter error messages
debuggingexception-handlingdevelopment-tools

More Software Development packages