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

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-0.3.0-py3-none-any.whl (76.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dexc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e22831c1ce9ef9a16f60624dd36c7e37c839bb28cc1e5f37d29ba3acc4c2c36
MD5 e7301b5cc332b64b0829b633e1e404bd
BLAKE2b-256 51ae183edcdd4cb6a3f02d33e00f2f35e5162d2daacec1a463753592482f7d8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dexc-0.3.0-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