Skip to main content

Enhanced exception handler with intelligent LLM that can fix errors and enhance output

Project description

ExceptHook

Description

This replaces the exception hook with one with a nice traceback and LLM integration for fixing errors

Usage

In any module that you are working in, when you run the module and an exception is triggered, the custom exception handler will be triggered. By default when the handler is triggered, the default traceback is printed but with a little enhancement using the rich library.

Options

If anywhere in your code there are any of these options trigger different behaviours.

  • #: fix
  • #: enhance
Fix

This will contact Groq LLM to fix the exception code.

Enhance

This will enhance the traceback in a well structured way

Environment

Create a virtual environment and activate it

Method 1

  • Clone the project and build the package locally then install using this command pip install .

Method 2

  • Install from PyPI using this command pip install excepthook.

Setup

  • Create a .env file with your GROQ_API_KEY
  • Run install_hook to write the sitecustomize.py in the sitepackages directory which will be providing the features.
Python

#: enhance
#: fix

def foo(*args, **kwargs):

    if not args:
        raise ValueError("No argument provided")

foo()

Sample python code to illustrate

Note: Enusre you have created a virtual environment, activated it and installed the packge in it.

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

excepthook-0.3.1.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

excepthook-0.3.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file excepthook-0.3.1.tar.gz.

File metadata

  • Download URL: excepthook-0.3.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for excepthook-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bba246bed12cf9f582e3037585973c059d2f8d04b1fa51c40b35ed1122f29cb0
MD5 aa0c545cb4cf6b9bfb11e0f077da28cd
BLAKE2b-256 7231dd08b73bda73876873a28744baa144766b26034c4ec686b7d8e49953e8fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for excepthook-0.3.1.tar.gz:

Publisher: excepthook-publish.yml on khonello/ExceptHook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file excepthook-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: excepthook-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for excepthook-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc85afa95d01fb85b5d1b7268113a5e1e78f866a06b2155174a943a94f938c3
MD5 ffdbefc5f418f12f768a32f90256c806
BLAKE2b-256 d9a75b265e69f4d9d6226d750c5dc5a8da74573b5ed1b652bccfde3b9eebee51

See more details on using hashes here.

Provenance

The following attestation bundles were made for excepthook-0.3.1-py3-none-any.whl:

Publisher: excepthook-publish.yml on khonello/ExceptHook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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