Skip to main content

Exception formatter

Project description

Dexc

Dexc is a Python exception formatter. It supports Python 3.11 and later.

Features

  • Context displayed in addition to the main line of each frame
  • Truncated trace lines when there are too many
  • Colorized stack trace obeying the the NO_COLOR environment variable
  • Minimization of frames when they are not part of the user code
  • Support for exception groups
  • Highlighting of re-raises i.e. when an exception is caught and re-raised with more than a simple raise, causing two stack traces to be concatenated without separation
  • Handling of unraisable exceptions e.g. raised in a destructor
  • Support for syntax errors
  • Support for exception notes
  • Support for warnings
  • Collapse of repeated frames or groups of frames
  • Disabling using the DEXC_DISABLE=1 environment variable
  • Support for allocation tracebacks occurring when a resource (such as a file object) is leaked or a coroutine is never awaited, given -X tracemalloc=N is set
  • Detection of repeated frames or frame groups
  • Support for IPython cells

Caveats

Dexc should not be used in production code or to format untrusted exceptions. Because it relies on certain CPython-specific APIs, it may break on other runtimes or if your code displays exotic behavior, such as modifying sys.modules or updating source files while the program is running.

Furthermore, Dexc may produce incorrect output if your code or exception messages contain non-ASCII characters.

Installation

$ pip install dexc

Usage

import dexc
dexc.install()

# Or:

import dexc.autoinstall

Related work

Name Local lookup Notes
backtrace no One line per frame
better-exceptions yes Same layout as the default
colored-traceback no Adds color to the default traceback
friendly-traceback no Provides error explanations
frosch yes
IPython ultratb no Same layout as the default
Pretty Traceback no One line per frame
pretty-errors yes
ptb no
Rich tracebacks no See also this article
rich-traceback no
stackprinter yes
TBVaccine yes Same layout as the default; includes .pth

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

dexc-1.1-py3-none-any.whl (82.7 kB view details)

Uploaded Python 3

File details

Details for the file dexc-1.1-py3-none-any.whl.

File metadata

  • Download URL: dexc-1.1-py3-none-any.whl
  • Upload date:
  • Size: 82.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dexc-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b0db865f87d4a989f6dafc60a9c2cd59b4fa7f276795298bfa7754d78d4201
MD5 5b24b3a1ba81c49ce2be3e7709e4dce7
BLAKE2b-256 1cf9c5336fbe158281dfb3bf2c7adc74ca447a7de45f8d26a8094f56ec1cec55

See more details on using hashes here.

Provenance

The following attestation bundles were made for dexc-1.1-py3-none-any.whl:

Publisher: publish.yml on slietar/dexc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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