<!-- TOC -->
* [Chatty Debug](#chatty-debug)
* [Installation](#installation)
* [Basic Usage](#basic-usage)
* [Function decorator](#function-decorator)
* [Script Wrapper](#script-wrapper)
* [Response](#response)
* [Advanced Usage](#advanced-usage)
* [Response](#response-1)
* [Chatty Improvements](#chatty-improvements)
* [Basic usage:](#basic-usage-)
* [Response](#response-2)
<!-- TOC -->
# 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
```python
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
```python
# 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](docs/english_response.png)
## 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.
```python
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](#script-wrapper), you can also do this command:
`python -m chatty_debug foo.py --prompt "Me ajude a entender esse erro."`
### Response
![Portuguese Response](docs/portuguese_response.png)
## 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.
```python
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](docs/suggested_improvements.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/danb27/chatty-debug",
"name": "chatty-debug",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "chatgpt,debugging,optimization,refactoring",
"author": "danb27",
"author_email": "danbianchini@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/6e/20/fac981b167b6217f49e9f56c49ae4a735267a32c26b775e3960709656901/chatty_debug-1.1.0.tar.gz",
"platform": null,
"description": "<!-- TOC -->\n* [Chatty Debug](#chatty-debug)\n * [Installation](#installation)\n * [Basic Usage](#basic-usage)\n * [Function decorator](#function-decorator)\n * [Script Wrapper](#script-wrapper)\n * [Response](#response)\n * [Advanced Usage](#advanced-usage)\n * [Response](#response-1)\n * [Chatty Improvements](#chatty-improvements)\n * [Basic usage:](#basic-usage-)\n * [Response](#response-2)\n<!-- TOC -->\n\n# Chatty Debug\nUse ChatGPT to debug your python code\n\n\n## Installation\n\n`pip install -U chatty-debug`\n\n**NOTE**: Requires OPENAI_API_KEY environment variable\n\n\n## Basic Usage\n\n### Function decorator\n\n```python\nfrom chatty_debug import chatty_debug\n\n\n@chatty_debug() # () is required\ndef foo():\n a = 0\n b = 10\n return 100 / a / b\n\n\nif __name__ == \"__main__\":\n foo()\n```\n\n### Script Wrapper\n\n```python\n# foo.py\n\ndef foo():\n a = 0\n b = 10\n return 100 / a / b\n\n\nif __name__ == \"__main__\":\n foo()\n```\n\n`python -m chatty_debug foo.py`\n\n### Response\n\n![English Response](docs/english_response.png)\n\n\n## Advanced Usage\n\nYou may also specify a unique prompt. For example, you can request a\nresponse in a different language, or provide more information about the\nerror that might not be available in the traceback.\n\n```python\nfrom chatty_debug import chatty_debug\n\n\n@chatty_debug(prompt=\"Me ajude a entender esse erro.\")\ndef foo():\n a = 0\n b = 10\n return 1000 / b / a\n\n\nif __name__ == \"__main__\":\n foo()\n```\n\nAdditionally, you can do the same with the script. Using the foo.py script\nfrom [above](#script-wrapper), you can also do this command:\n\n`python -m chatty_debug foo.py --prompt \"Me ajude a entender esse erro.\"`\n\n### Response\n\n![Portuguese Response](docs/portuguese_response.png)\n\n## Chatty Improvements\n\nchatty-debug can also suggest improvements for your code.\n\n### Basic usage:\n\nWithout further configuration, the decorator will submit a default prompt\npresenting your function. ChatGPT will then be asked to suggest\nimprovements to it. It will then be asked to suggest some tests to improve\nit. These default prompts can be edited, removed, and added to.\n\n```python\nfrom chatty_debug import suggest_improvements\n\n\n@suggest_improvements() # () is required\ndef foo(value, set=set()):\n list=list(set)\n for val1 in list:\n if value == val1:\n return True\n return False\n\n\nif __name__ == '__main__':\n foo()\n```\n\n### Response\n\n![Suggested Improvements](docs/suggested_improvements.png)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Package for debugging python using ChatGPT",
"version": "1.1.0",
"split_keywords": [
"chatgpt",
"debugging",
"optimization",
"refactoring"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cc307682941808ed6a1bcc3d443adfd294dbc143da7709973fe939292f778d77",
"md5": "1e5a50732a9924a764b11c999292684b",
"sha256": "bbba0bc7036582de42134abd6acf137d938d3be4c56448f8136ef3167e636dda"
},
"downloads": -1,
"filename": "chatty_debug-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e5a50732a9924a764b11c999292684b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 6070,
"upload_time": "2023-03-23T06:19:34",
"upload_time_iso_8601": "2023-03-23T06:19:34.985216Z",
"url": "https://files.pythonhosted.org/packages/cc/30/7682941808ed6a1bcc3d443adfd294dbc143da7709973fe939292f778d77/chatty_debug-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6e20fac981b167b6217f49e9f56c49ae4a735267a32c26b775e3960709656901",
"md5": "6cb75080c62dfd142c254b7c227bd40b",
"sha256": "c2f4c9fea20c6576fc59343e31683216fd3f1dbed0f005d96ca52a8d53cba3c5"
},
"downloads": -1,
"filename": "chatty_debug-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6cb75080c62dfd142c254b7c227bd40b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 5011,
"upload_time": "2023-03-23T06:19:36",
"upload_time_iso_8601": "2023-03-23T06:19:36.578770Z",
"url": "https://files.pythonhosted.org/packages/6e/20/fac981b167b6217f49e9f56c49ae4a735267a32c26b775e3960709656901/chatty_debug-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-23 06:19:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "danb27",
"github_project": "chatty-debug",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "chatty-debug"
}