Skip to main content

Automatically apply traceback styling akin to Jetbrains Traceback highlighting, providing much easier debugging and log searching, as-well as feel more at home away from PyCharm

Project description

Charmed Traceback

JetBrains style Tracebacks everywhere.
Automatically apply traceback styling akin to Jetbrains Traceback highlighting, providing much easier debugging and log searching, as-well as feel more at home away from PyCharm

Installation

Through pip:

pip install charmed-traceback

Build with poetry:

pip install Poetry
poetry build

Usage

Charmed Traceback can be executed as a module:

python -m charmed_traceback somefile.py

Charmed Traceback also works well within a script or even directly in the interpreter REPL. Standard usage will re-stylize the output, unless it's being redirected to a pipe:

import charmed_traceback
charmed_traceback.add_hook()

If want to retain the charmed style even when stderr is being piped, tack on an always=True argument:

import charmed_traceback
charmed_traceback.add_hook(always=True)

There are also a couple of convenience imports, which get the footprint down to one line:

# Same as add_hook()
import charmed_traceback.auto

# Same as add_hook(always=True)
import charmed_traceback.always

When implementing with a project that alternates between having access to development dependencies and not having those dependencies, it would be most convenient to provide a context manager to use this Charmed Tracebacks:

import contextlib

def dev_charm_traceback_handler() -> None:
    with contextlib.suppress(ImportError):
        import charmed_traceback.auto

# This call can be left in a project regaurdless of the presence of Charmed Traceback package.
dev_charm_traceback_handler()

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.

charmed_traceback-0.1.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for charmed_traceback-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 595e91a83269058d45719fd08e2d08fea2c8d6c066a891c67123ebb4d95f1022
MD5 b6367290750bcf6135b0e4ec2509f60a
BLAKE2b-256 341b74345acf9cb0813be89950f811725f4ddf84795f762ad049ac0a19310329

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