Skip to main content

Turn Python stack traces into cleaner, more readable output

Project description

philiprehberger-stacktrace

Tests PyPI version License

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) — Replace sys.excepthook
  • format_exception(exc) — Returns ExceptionReport
  • report.short() — One-line summary
  • report.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

philiprehberger_stacktrace-0.1.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

philiprehberger_stacktrace-0.1.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_stacktrace-0.1.2.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_stacktrace-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a8ffb54b3a599e8194d5a1510ac38f583b0519a8c5d70747fc84c717b2e3ec11
MD5 c16ac1d2b92a94824ee131f485e76d24
BLAKE2b-256 788d792ae182e9c1502e84e61f00c0e14466c71f58822a6969d707868a5da8ef

See more details on using hashes here.

File details

Details for the file philiprehberger_stacktrace-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_stacktrace-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ded284b17ec9e941436d1a2710cd98780407918257a03f6064a509eeebad206
MD5 c323810885e1f00ed7c53f4124ae66e5
BLAKE2b-256 ec37f1454c0dd2e0ee07b0344993dfbba302a24b3296c313698cea876dc0e6bf

See more details on using hashes here.

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