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=1environment 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=Nis 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5b0db865f87d4a989f6dafc60a9c2cd59b4fa7f276795298bfa7754d78d4201
|
|
| MD5 |
5b24b3a1ba81c49ce2be3e7709e4dce7
|
|
| BLAKE2b-256 |
1cf9c5336fbe158281dfb3bf2c7adc74ca447a7de45f8d26a8094f56ec1cec55
|
Provenance
The following attestation bundles were made for dexc-1.1-py3-none-any.whl:
Publisher:
publish.yml on slietar/dexc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dexc-1.1-py3-none-any.whl -
Subject digest:
e5b0db865f87d4a989f6dafc60a9c2cd59b4fa7f276795298bfa7754d78d4201 - Sigstore transparency entry: 642094827
- Sigstore integration time:
-
Permalink:
slietar/dexc@b143e0facadd2e60b9bc4f6b977a7b92b01eec8c -
Branch / Tag:
refs/tags/1.1 - Owner: https://github.com/slietar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b143e0facadd2e60b9bc4f6b977a7b92b01eec8c -
Trigger Event:
push
-
Statement type: