Turn Python stack traces into cleaner, more readable output
Project description
philiprehberger-stacktrace
Turn Python stack traces into cleaner, more readable output.
Installation
pip install philiprehberger-stacktrace
Usage
Global Install
from philiprehberger_stacktrace import install
install() # replaces sys.excepthook
Manual Formatting
from philiprehberger_stacktrace import format_exception
try:
risky_operation()
except Exception as e:
report = format_exception(e)
print(report.short()) # one-line summary
print(report.detailed()) # colored with source context
Features
- Colored output with syntax highlighting
- Source context lines around the error
- Hides stdlib/site-packages frames by default
- Exception chain display (
raise ... from ...) - One-line summary mode
API
install(color=True, context=2, hide_stdlib=True)— Replacesys.excepthookformat_exception(exc)— ReturnsExceptionReportreport.short()— One-line summaryreport.detailed(color, context, hide_stdlib)— Full formatted output
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 philiprehberger_stacktrace-0.1.3.tar.gz.
File metadata
- Download URL: philiprehberger_stacktrace-0.1.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68cae5147c43ab9c4cbcc56c329b2031b77cc9a6fdbf98e04dc5958fffac1ed9
|
|
| MD5 |
03295850117a4c03f049ce1122a32546
|
|
| BLAKE2b-256 |
62a5a23e99970e9612ee5fde8d8a7eb00d438a29024d6555274c1f763459ef76
|
File details
Details for the file philiprehberger_stacktrace-0.1.3-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_stacktrace-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa55168d73cc161d26a8bbca2bfaa00d3520045227cfdf55f0fb9a54cd560a31
|
|
| MD5 |
2f9b38fcb33cebc906f3aef15baa2fa4
|
|
| BLAKE2b-256 |
c7b626491d57603bf10a2ee04620f643ef718c71e989ec14d3de69bec536d4b3
|