fro

frosch

🐸 Debug faster than a frog catches a fly

Showing:

Popularity

Downloads/wk

0

GitHub Stars

192

Maintenance

Last Commit

5d ago

Contributors

4

Package

Dependencies

6

License

MIT

Categories

Readme

frosch - Runtime Error Debugger

PyPI version Codecov Pytho_Version

Better runtime error messages

Are you also constantly seeing the runtime error message the python interpreter is giving you? It lacks some color and more debug information!

Get some good looking error tracebacks and beautifuly formatted last line with all its last values before you crashed the program.

Installation

$ pip install frosch

Usage

Call the hook function at the beginning of your program.


from frosch import hook

hook()

x = 3 + "String"

You can also easily print your catched exceptions to stdout


from frosch import print_exception

try:
  x = [0, 1]
  x[3]
except IndexError as error:
  print_exception(error)

Configuration

Themes

frosch allows to use different themes for styling the output:

Themes
abapbwigornativerrttrac
algolcolorfulinkpotparaiso_darksasvim
algol_nudefaultlovelaceparaiso_lightsolarizedvs
arduinoemacsmannipastiestata_darkxcode
autumnfriendlymonokaiperldocstata_light
borlandfruitymurphyrainbow_dashtango

Usage:

from frosch import hook

hook(theme="vim")

Custom Themes

You can also define custom themes by by subclassing Style (which is just a thin wrapper around pygments styles) and pass it to the hook. For more information please use the pygments docs.


from frosch import hook
from frosch.style import Style
from frosch.style.token import Keyword, Name, Comment, String, Error, \
     Number, Operator, Generic

class CustomStyle(Style):
    default_style = ""
    styles = {
        Comment:                'italic #888',
        Keyword:                'bold #005',
        Name:                   '#f00',
        Name.Function:          '#0f0',
        Name.Class:             'bold #0f0',
        String:                 'bg:#eee #111'
    }

hook(theme=CustomStyle)

OS Notifications

But wait there is more!

Running longer scripts in the background?

Just add a title and/or message to the hook and it will you give a notification when your program is crashing.


from frosch import hook

hook(
  theme="vs", # VSCode Theme
  title="I crashed!",
  message="Run Number #1444 is also crashing..."
)

This works on MacOS (osascript), Linux (notify-send) and Windows (powershell).

Contribution

frosch uses poetry for build and dependency management, so please install beforehand.

Setup

$ git clone https://github.com/HallerPatrick/frosch.git
$ poetry install

Run tests

$ python -m pytest tests

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100