Skip to main content

Python package that optimises AI-assisted coding.

Project description

PromptableTraceback

Overview

PromptableTraceback is a lightweight Python debugging library designed to optimise AI-assisted coding.

Why use it? When code fails, you typically spend a couple minutes gathering relevant lines of code, checking variable states, and copying the traceback into an LLM to help you debug. This library automates that process by capturing the "state of the world" at the exact moment of failure and formatting it into a clean, LLM-ready report.

Installation

Install PromptableTraceback via pip from PyPI:

pip install promptable-traceback

Requirements:

  • Python 3.7+
  • Works across Windows, MacOS, and Linux

Example Usage

Targeted monitoring: Use the @promptable_traceback.catch decorator to capture errors that occur within a specific function.

import promptable_traceback

@promptable_traceback.catch()  # Initialise locally.
def my_func(var1):
    var1 = int(var1)  # Trigger an error.

my_func("frfr")

Universal monitoring: Use promptable_traceback.hook to capture any unhandled errors across your entire application.

import promptable_traceback

promptable_traceback.hook()  # Initialise globally.

def my_func(var1):
    var1 = int(var1)  # Trigger an error.

my_func("frfr")

API Reference

The following parameters are available for targeted and universal monitoring.

  • context_window (int): The number of lines captured above and below the line of code which errored. Set to 25 by default. Note: This is capped by the boundaries of the function when using the decorator, or the boundaries of the file when using the hook.
  • mask_secrets (bool): When set to True, variables containing sensitive data will have their values redacted. Set to True by default.

Suggestions & Feedback

I am always looking for ways to make this tool more useful for different development workflows.

If you have ideas for:

  • Alternative invocation: Different ways to trigger the library into specific frameworks.
  • Tailored reporting: Ideas for specific report formats that work better for certain LLMs or specialised debugging scenarios.
  • Feature requests: Anything else that would make your debugging life easier.

Please feel free to open an issue or reach out!

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

promptable_traceback-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

promptable_traceback-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file promptable_traceback-1.0.0.tar.gz.

File metadata

  • Download URL: promptable_traceback-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for promptable_traceback-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fa0b4157484b723dc9b189d71ba96d36a52f03d076a8bf12003c26002e248e85
MD5 48a90bd42710883b5f77ff87975aadb6
BLAKE2b-256 5f7a064f4a704200c589b5477d6f2320fc5a01207698ba89566f1de5904eb35a

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptable_traceback-1.0.0.tar.gz:

Publisher: publish.yml on Repmak/promptable-traceback

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

File details

Details for the file promptable_traceback-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for promptable_traceback-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afbea65975751b23b4d67ede41a60136c4fc7cd675e0f79b2e83d30e020da42e
MD5 147922d70869c068b50ff57e401bd047
BLAKE2b-256 39f3c69457dd4d6506f37eed4bd0131b34e4ecb473773445091b8e95a07608d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptable_traceback-1.0.0-py3-none-any.whl:

Publisher: publish.yml on Repmak/promptable-traceback

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