scriptmonkey


Namescriptmonkey JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/lukerbs/CodeMonkey
SummaryA Python package that automatically fixes errors in your code using OpenAI's GPT API
upload_time2024-10-04 19:27:24
maintainerNone
docs_urlNone
authorLuke Kerbs
requires_python>=3.6
licenseMIT
keywords openai gpt ai code error fixing code automation gpt api error correction code assistant ai coding tools code monkey script monkey automation development tools python tools code analysis machine learning
VCS
bugtrack_url
requirements annotated-types anyio certifi charset-normalizer distro docutils h11 httpcore httpx idna importlib_metadata jaraco.classes jaraco.context jaraco.functools jiter keyring markdown-it-py mdurl more-itertools nh3 openai pkginfo pydantic pydantic_core Pygments python-dotenv readme_renderer requests requests-toolbelt rfc3986 rich setuptools sniffio tqdm twine typing_extensions urllib3 wheel zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# ScriptMonkey 🐒

ScriptMonkey is a Python package that automatically detects and fixes errors in your code using OpenAI's GPT API. It works with any IDE or code editor, analyzing your code at runtime, providing solutions to errors, and even updating the file with the corrected code.

## Features
- **Automatic error detection**: Captures errors during runtime.
- **AI-powered fixes**: Uses OpenAI's GPT API to understand and resolve errors.
- **Code auto-correction**: Automatically updates your Python files with the fixes.
- **Cross-IDE compatibility**: Works with any IDE or code editor.

## Installation

To install ScriptMonkey, simply run:

```bash
pip install scriptmonkey
```

## Usage

1. Import `scriptmonkey` in your Python script.
2. Call `scriptmonkey.run()` to activate the error handler.
3. Run your code, and let ScriptMonkey handle any errors that occur.

### Example

```python
import scriptmonkey

# Enable Codemonkey's error handler
scriptmonkey.run()

# Intentional error for testing
def add(a, b):
    return a + b  # This will fail if b is a string

print(add(2, "3"))  # Codemonkey will automatically fix this error and update the file
```

Once an error occurs, ScriptMonkey will:
1. Detect the error.
2. Send the error and code to OpenAI for analysis.
3. Provide a solution and automatically update the file with the correct code.

## How It Works

ScriptMonkey replaces Python's default exception handling with a custom handler. When an error is caught, it:
- Collects the traceback and the Python file that caused the error.
- Sends the error message and code to OpenAI.
- Receives the solution as structured JSON.
- Applies the fix directly to the source file.

## Requirements
- Python 3.6 or later
- OpenAI API key

## Setup

To use ScriptMonkey, you'll need an OpenAI API key. Set it up as follows:

```bash
export OPENAI_API_KEY='your-api-key'
```

Let ScriptMonkey take care of your Python errors so you can focus on building!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lukerbs/CodeMonkey",
    "name": "scriptmonkey",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "openai, GPT, AI, code error fixing, code automation, GPT API, error correction, code assistant, AI coding tools, code monkey, script monkey, automation, development tools, python tools, code analysis, machine learning",
    "author": "Luke Kerbs",
    "author_email": "LDK.kerbs@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/86/c3/a86550e9295e8d10949193b760285c63cef8452eb98a6b275795cd93f5a9/scriptmonkey-0.1.2.tar.gz",
    "platform": null,
    "description": "\n# ScriptMonkey \ud83d\udc12\n\nScriptMonkey is a Python package that automatically detects and fixes errors in your code using OpenAI's GPT API. It works with any IDE or code editor, analyzing your code at runtime, providing solutions to errors, and even updating the file with the corrected code.\n\n## Features\n- **Automatic error detection**: Captures errors during runtime.\n- **AI-powered fixes**: Uses OpenAI's GPT API to understand and resolve errors.\n- **Code auto-correction**: Automatically updates your Python files with the fixes.\n- **Cross-IDE compatibility**: Works with any IDE or code editor.\n\n## Installation\n\nTo install ScriptMonkey, simply run:\n\n```bash\npip install scriptmonkey\n```\n\n## Usage\n\n1. Import `scriptmonkey` in your Python script.\n2. Call `scriptmonkey.run()` to activate the error handler.\n3. Run your code, and let ScriptMonkey handle any errors that occur.\n\n### Example\n\n```python\nimport scriptmonkey\n\n# Enable Codemonkey's error handler\nscriptmonkey.run()\n\n# Intentional error for testing\ndef add(a, b):\n    return a + b  # This will fail if b is a string\n\nprint(add(2, \"3\"))  # Codemonkey will automatically fix this error and update the file\n```\n\nOnce an error occurs, ScriptMonkey will:\n1. Detect the error.\n2. Send the error and code to OpenAI for analysis.\n3. Provide a solution and automatically update the file with the correct code.\n\n## How It Works\n\nScriptMonkey replaces Python's default exception handling with a custom handler. When an error is caught, it:\n- Collects the traceback and the Python file that caused the error.\n- Sends the error message and code to OpenAI.\n- Receives the solution as structured JSON.\n- Applies the fix directly to the source file.\n\n## Requirements\n- Python 3.6 or later\n- OpenAI API key\n\n## Setup\n\nTo use ScriptMonkey, you'll need an OpenAI API key. Set it up as follows:\n\n```bash\nexport OPENAI_API_KEY='your-api-key'\n```\n\nLet ScriptMonkey take care of your Python errors so you can focus on building!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package that automatically fixes errors in your code using OpenAI's GPT API",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/lukerbs/CodeMonkey"
    },
    "split_keywords": [
        "openai",
        " gpt",
        " ai",
        " code error fixing",
        " code automation",
        " gpt api",
        " error correction",
        " code assistant",
        " ai coding tools",
        " code monkey",
        " script monkey",
        " automation",
        " development tools",
        " python tools",
        " code analysis",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dabd475f8c63245adfa10b9f5f074e199f53c4453c51d9aa79ad07a40ae6eeef",
                "md5": "e152fc0bdb6c1f65b6617f8e46da2d7d",
                "sha256": "fd42b1665efe6ac3a152295456dbc3e8adaa39a962e227717cf87ba404cd4c02"
            },
            "downloads": -1,
            "filename": "scriptmonkey-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e152fc0bdb6c1f65b6617f8e46da2d7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11143,
            "upload_time": "2024-10-04T19:27:22",
            "upload_time_iso_8601": "2024-10-04T19:27:22.441219Z",
            "url": "https://files.pythonhosted.org/packages/da/bd/475f8c63245adfa10b9f5f074e199f53c4453c51d9aa79ad07a40ae6eeef/scriptmonkey-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86c3a86550e9295e8d10949193b760285c63cef8452eb98a6b275795cd93f5a9",
                "md5": "6ed776f7020dd2b0dbe1fcf5be3d5e23",
                "sha256": "30ed21c29cac9a6ad7bb285a078c9100157176cbc47b82e89bc8293d5f81718f"
            },
            "downloads": -1,
            "filename": "scriptmonkey-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6ed776f7020dd2b0dbe1fcf5be3d5e23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5638,
            "upload_time": "2024-10-04T19:27:24",
            "upload_time_iso_8601": "2024-10-04T19:27:24.419235Z",
            "url": "https://files.pythonhosted.org/packages/86/c3/a86550e9295e8d10949193b760285c63cef8452eb98a6b275795cd93f5a9/scriptmonkey-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-04 19:27:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lukerbs",
    "github_project": "CodeMonkey",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "annotated-types",
            "specs": [
                [
                    "==",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "anyio",
            "specs": [
                [
                    "==",
                    "4.6.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "distro",
            "specs": [
                [
                    "==",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "docutils",
            "specs": [
                [
                    "==",
                    "0.21.2"
                ]
            ]
        },
        {
            "name": "h11",
            "specs": [
                [
                    "==",
                    "0.14.0"
                ]
            ]
        },
        {
            "name": "httpcore",
            "specs": [
                [
                    "==",
                    "1.0.6"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "==",
                    "0.27.2"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "importlib_metadata",
            "specs": [
                [
                    "==",
                    "8.5.0"
                ]
            ]
        },
        {
            "name": "jaraco.classes",
            "specs": [
                [
                    "==",
                    "3.4.0"
                ]
            ]
        },
        {
            "name": "jaraco.context",
            "specs": [
                [
                    "==",
                    "6.0.1"
                ]
            ]
        },
        {
            "name": "jaraco.functools",
            "specs": [
                [
                    "==",
                    "4.1.0"
                ]
            ]
        },
        {
            "name": "jiter",
            "specs": [
                [
                    "==",
                    "0.5.0"
                ]
            ]
        },
        {
            "name": "keyring",
            "specs": [
                [
                    "==",
                    "25.4.1"
                ]
            ]
        },
        {
            "name": "markdown-it-py",
            "specs": [
                [
                    "==",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "mdurl",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "more-itertools",
            "specs": [
                [
                    "==",
                    "10.5.0"
                ]
            ]
        },
        {
            "name": "nh3",
            "specs": [
                [
                    "==",
                    "0.2.18"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    "==",
                    "1.51.0"
                ]
            ]
        },
        {
            "name": "pkginfo",
            "specs": [
                [
                    "==",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "==",
                    "2.9.2"
                ]
            ]
        },
        {
            "name": "pydantic_core",
            "specs": [
                [
                    "==",
                    "2.23.4"
                ]
            ]
        },
        {
            "name": "Pygments",
            "specs": [
                [
                    "==",
                    "2.18.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "readme_renderer",
            "specs": [
                [
                    "==",
                    "44.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "requests-toolbelt",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "rfc3986",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "13.9.2"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "==",
                    "75.1.0"
                ]
            ]
        },
        {
            "name": "sniffio",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "==",
                    "4.66.5"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "5.1.1"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": [
                [
                    "==",
                    "0.44.0"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.20.2"
                ]
            ]
        }
    ],
    "lcname": "scriptmonkey"
}
        
Elapsed time: 0.86976s