Skip to main content

Package for debugging python using ChatGPT

Project description

Chatty Debug

Use ChatGPT to debug your python code

Installation

pip install -U chatty-debug

NOTE: Requires OPENAI_API_KEY environment variable

Basic Usage

Function decorator

from chatty_debug import chatty_debug


@chatty_debug()  # () is required
def foo():
    a = 0
    b = 10
    return 100 / a / b


if __name__ == "__main__":
    foo()

Script Wrapper

# foo.py

def foo():
    a = 0
    b = 10
    return 100 / a / b


if __name__ == "__main__":
    foo()

python -m chatty_debug foo.py

Response

English Response

Advanced Usage

You may also specify a unique prompt. For example, you can request a response in a different language, or provide more information about the error that might not be available in the traceback.

from chatty_debug import chatty_debug


@chatty_debug(prompt="Me ajude a entender esse erro.")
def foo():
    a = 0
    b = 10
    return 1000 / b / a


if __name__ == "__main__":
    foo()

Additionally, you can do the same with the script. Using the foo.py script from above, you can also do this command:

python -m chatty_debug foo.py --prompt "Me ajude a entender esse erro."

Response

Portuguese Response

Chatty Improvements

chatty-debug can also suggest improvements for your code.

Basic usage:

Without further configuration, the decorator will submit a default prompt presenting your function. ChatGPT will then be asked to suggest improvements to it. It will then be asked to suggest some tests to improve it. These default prompts can be edited, removed, and added to.

from chatty_debug import suggest_improvements


@suggest_improvements()   # () is required
def foo(value, set=set()):
    list=list(set)
    for val1 in list:
        if value == val1:
            return True
    return False


if __name__ == '__main__':
    foo()

Response

Suggested Improvements

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

chatty_debug-1.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

chatty_debug-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file chatty_debug-1.1.0.tar.gz.

File metadata

  • Download URL: chatty_debug-1.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.0 Linux/5.15.0-1034-azure

File hashes

Hashes for chatty_debug-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c2f4c9fea20c6576fc59343e31683216fd3f1dbed0f005d96ca52a8d53cba3c5
MD5 6cb75080c62dfd142c254b7c227bd40b
BLAKE2b-256 6e20fac981b167b6217f49e9f56c49ae4a735267a32c26b775e3960709656901

See more details on using hashes here.

File details

Details for the file chatty_debug-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatty_debug-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.0 Linux/5.15.0-1034-azure

File hashes

Hashes for chatty_debug-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbba0bc7036582de42134abd6acf137d938d3be4c56448f8136ef3167e636dda
MD5 1e5a50732a9924a764b11c999292684b
BLAKE2b-256 cc307682941808ed6a1bcc3d443adfd294dbc143da7709973fe939292f778d77

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