gptmypr


Namegptmypr JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/waclawthedev/GPTmyPR
SummaryCLI tool that uses OpenAI's GPT to change your code according to comments in the GitHub pull request
upload_time2024-01-24 21:33:17
maintainer
docs_urlNone
authorwaclawthedev
requires_python
licenseMIT
keywords gptmypr pull request code review refactoring code quality chatgpt gpt openai github
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GPTmyPR

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/167ca4e9157343d6b632bfed3e663c87)](https://app.codacy.com/gh/waclawthedev/GPTmyPR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

GPTmyPR is a Python command-line tool that uses OpenAI's GPT to change your code according to comments in the GitHub
pull request.

## Installation

```bash
pip install gptmypr
```

## Configuration

A configuration file will be created during the first run. You'll need a GitHub token and an OpenAI API key to use
GPTmyPR.

### How to generate a GitHub Token:

*   Visit https://github.com/settings/tokens.
*   Select 'Personal access tokens', then 'Fine-grained tokens'.
*   Click 'Generate new token'.
*   Specify 'Repository access' for the desired repository.
*   Choose 'Access: Read-only' for 'Contents' and 'Access: Read and write' for 'Pull requests'.

### How to generate an OpenAI API Key:

*   Go to https://platform.openai.com/api-keys.
*   Click 'Create new secret key'.

## Author's opinion about model choice

Updated: **1/23/2024**. It is recommended to check the official page for the latest
information: https://platform.openai.com/docs/models/ and https://openai.com/pricing.

| Model              | Price          | Speed     | Quality for gptmypr | Note                                                                                      | Token limit (the higher the number, the larger the file you can process). Remember, you pay for every token used per request. |
|--------------------|----------------|-----------|---------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| gpt-4-1106-preview | Moderate       | Medium    | Optimal             | Good choice for most tasks; also has recent knowledge base.                               | 128,000 tokens                                                                                                                |
| gpt-4              | Expensive      | Slow      | The best            | Slow, but the most intelligent.                                                           | 8,192 tokens                                                                                                                  |
| gpt-3.5-turbo-1106 | Cheap          | Fast      | Below average       | Fast, but not always accurate with results.                                               | 16,385 tokens                                                                                                                 |
| gpt-3.5-turbo      | Very cheap     | Very fast | Below average       | The cheapest and fastest way to work with small source files and process simple comments. | 4,096 tokens                                                                                                                  |

## Changing Configuration Later

Edit the configuration file usually located at `~/.gptmypr.conf.json`:

```json
{
  "openai_apikey": "YOUR_OPENAI_API_KEY",
  "github_token": "YOUR_GITHUB_TOKEN",
  "openai_model": "OPENAI_MODEL_NAME",
  "reaction_to_mark_comment_as_read": "REACTION_NAME"
}
```

To modify the configuration at any time, replace `YOUR_OPENAI_API_KEY`, `YOUR_GITHUB_TOKEN`, `OPENAI_MODEL_NAME`,
and `REACTION_NAME` with your respective OpenAI API Key, GitHub token, preferred OpenAI model name, and the reaction to
mark comments as read (+1, -1, laugh, confused, heart, hooray, rocket, or eyes).

## Usage

Execute the tool from the command line within your git repository:

```bash
gptmypr [--config CONFIG_PATH] [--verbose] [--pr PR_NUMBER]
```

### Arguments

*   `--pr`: The pull request number (mandatory). While on the PR page, look at the URL. The integer at the end is the PR
  number.
*   `--config`: The path to the configuration file (optional, default value is `~/.gptmypr.conf.json`).
*   `--verbose`: Enables verbose output (optional).

## Limitations

*   The code improvements will be performed by using only the file related to the comment. It means that GPT will not
  account for the entire project when processing the comment - only its file.
*   Only comments attached to a line of code will be processed.
*   The file size that can be processed by the model is limited by the model's context window. Also, models with a larger
  window may cost more.
*   Not every result can be accurate. Use the tool to make refactoring easier, but check everything before committing :)

## Expenses

The script will send the entire source code file, along with comments and instructions, to the OpenAI API. The response
will contain the full version of the improved source code. The larger or more files you process, the higher your bill
will be from OpenAI. The script will display the count of prompt and response tokens used during the OpenAI API calls
upon completion to help you understand the expenses. You can make estimations based on the prices listed
here: https://openai.com/pricing. Additionally, don't forget to review the usage stats
here: https://platform.openai.com/usage or/and set usage limits here: https://platform.openai.com/account/limits.

## Privacy

As previously mentioned, source code that you are planning to change using gptmypr will be sent to the OpenAI API for
processing. Ensure that the code owners allow such actions.

## License

This software and its source code are released under the MIT License and are provided "AS IS". The author is not liable 
for any outcomes, damages or expenses, including those from software bugs, third-party libraries used in the project, 
or the use of paid OpenAI APIs, among others.

## Contributing

Your pull requests are welcome. For significant changes, please open an issue first to discuss your proposed changes.

## Support

Should you encounter any issues, kindly open an issue on the project's GitHub repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/waclawthedev/GPTmyPR",
    "name": "gptmypr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "gptmypr,pull request,code review,refactoring,code quality,ChatGPT,GPT,OpenAI,GitHub",
    "author": "waclawthedev",
    "author_email": "waclawthedev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/da/44168082e369249126e014d67288a946f409f63a6a0a8bc1f1a04e180b94/gptmypr-0.1.0.tar.gz",
    "platform": null,
    "description": "# GPTmyPR\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/167ca4e9157343d6b632bfed3e663c87)](https://app.codacy.com/gh/waclawthedev/GPTmyPR/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)\n\nGPTmyPR is a Python command-line tool that uses OpenAI's GPT to change your code according to comments in the GitHub\npull request.\n\n## Installation\n\n```bash\npip install gptmypr\n```\n\n## Configuration\n\nA configuration file will be created during the first run. You'll need a GitHub token and an OpenAI API key to use\nGPTmyPR.\n\n### How to generate a GitHub Token:\n\n*   Visit https://github.com/settings/tokens.\n*   Select 'Personal access tokens', then 'Fine-grained tokens'.\n*   Click 'Generate new token'.\n*   Specify 'Repository access' for the desired repository.\n*   Choose 'Access: Read-only' for 'Contents' and 'Access: Read and write' for 'Pull requests'.\n\n### How to generate an OpenAI API Key:\n\n*   Go to https://platform.openai.com/api-keys.\n*   Click 'Create new secret key'.\n\n## Author's opinion about model choice\n\nUpdated: **1/23/2024**. It is recommended to check the official page for the latest\ninformation: https://platform.openai.com/docs/models/ and https://openai.com/pricing.\n\n| Model              | Price          | Speed     | Quality for gptmypr | Note                                                                                      | Token limit (the higher the number, the larger the file you can process). Remember, you pay for every token used per request. |\n|--------------------|----------------|-----------|---------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| gpt-4-1106-preview | Moderate       | Medium    | Optimal             | Good choice for most tasks; also has recent knowledge base.                               | 128,000 tokens                                                                                                                |\n| gpt-4              | Expensive      | Slow      | The best            | Slow, but the most intelligent.                                                           | 8,192 tokens                                                                                                                  |\n| gpt-3.5-turbo-1106 | Cheap          | Fast      | Below average       | Fast, but not always accurate with results.                                               | 16,385 tokens                                                                                                                 |\n| gpt-3.5-turbo      | Very cheap     | Very fast | Below average       | The cheapest and fastest way to work with small source files and process simple comments. | 4,096 tokens                                                                                                                  |\n\n## Changing Configuration Later\n\nEdit the configuration file usually located at `~/.gptmypr.conf.json`:\n\n```json\n{\n  \"openai_apikey\": \"YOUR_OPENAI_API_KEY\",\n  \"github_token\": \"YOUR_GITHUB_TOKEN\",\n  \"openai_model\": \"OPENAI_MODEL_NAME\",\n  \"reaction_to_mark_comment_as_read\": \"REACTION_NAME\"\n}\n```\n\nTo modify the configuration at any time, replace `YOUR_OPENAI_API_KEY`, `YOUR_GITHUB_TOKEN`, `OPENAI_MODEL_NAME`,\nand `REACTION_NAME` with your respective OpenAI API Key, GitHub token, preferred OpenAI model name, and the reaction to\nmark comments as read (+1, -1, laugh, confused, heart, hooray, rocket, or eyes).\n\n## Usage\n\nExecute the tool from the command line within your git repository:\n\n```bash\ngptmypr [--config CONFIG_PATH] [--verbose] [--pr PR_NUMBER]\n```\n\n### Arguments\n\n*   `--pr`: The pull request number (mandatory). While on the PR page, look at the URL. The integer at the end is the PR\n  number.\n*   `--config`: The path to the configuration file (optional, default value is `~/.gptmypr.conf.json`).\n*   `--verbose`: Enables verbose output (optional).\n\n## Limitations\n\n*   The code improvements will be performed by using only the file related to the comment. It means that GPT will not\n  account for the entire project when processing the comment - only its file.\n*   Only comments attached to a line of code will be processed.\n*   The file size that can be processed by the model is limited by the model's context window. Also, models with a larger\n  window may cost more.\n*   Not every result can be accurate. Use the tool to make refactoring easier, but check everything before committing :)\n\n## Expenses\n\nThe script will send the entire source code file, along with comments and instructions, to the OpenAI API. The response\nwill contain the full version of the improved source code. The larger or more files you process, the higher your bill\nwill be from OpenAI. The script will display the count of prompt and response tokens used during the OpenAI API calls\nupon completion to help you understand the expenses. You can make estimations based on the prices listed\nhere: https://openai.com/pricing. Additionally, don't forget to review the usage stats\nhere: https://platform.openai.com/usage or/and set usage limits here: https://platform.openai.com/account/limits.\n\n## Privacy\n\nAs previously mentioned, source code that you are planning to change using gptmypr will be sent to the OpenAI API for\nprocessing. Ensure that the code owners allow such actions.\n\n## License\n\nThis software and its source code are released under the MIT License and are provided \"AS IS\". The author is not liable \nfor any outcomes, damages or expenses, including those from software bugs, third-party libraries used in the project, \nor the use of paid OpenAI APIs, among others.\n\n## Contributing\n\nYour pull requests are welcome. For significant changes, please open an issue first to discuss your proposed changes.\n\n## Support\n\nShould you encounter any issues, kindly open an issue on the project's GitHub repository.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI tool that uses OpenAI's GPT to change your code according to comments in the GitHub pull request",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/waclawthedev/GPTmyPR"
    },
    "split_keywords": [
        "gptmypr",
        "pull request",
        "code review",
        "refactoring",
        "code quality",
        "chatgpt",
        "gpt",
        "openai",
        "github"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bfda44168082e369249126e014d67288a946f409f63a6a0a8bc1f1a04e180b94",
                "md5": "d7d8d19f92fd1f0b67d13f8bc4c32487",
                "sha256": "304ca8b04b06c75da058fa3cd21f15127ec43095ab195aabd26bfcaf4ba4026f"
            },
            "downloads": -1,
            "filename": "gptmypr-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d7d8d19f92fd1f0b67d13f8bc4c32487",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11017,
            "upload_time": "2024-01-24T21:33:17",
            "upload_time_iso_8601": "2024-01-24T21:33:17.611878Z",
            "url": "https://files.pythonhosted.org/packages/bf/da/44168082e369249126e014d67288a946f409f63a6a0a8bc1f1a04e180b94/gptmypr-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-24 21:33:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "waclawthedev",
    "github_project": "GPTmyPR",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gptmypr"
}
        
Elapsed time: 0.16846s