gpt-pr 0.5.0__tar.gz → 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gpt-pr might be problematic. Click here for more details.
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/PKG-INFO +1 -1
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/README.md +76 -5
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/PKG-INFO +1 -1
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/requires.txt +4 -6
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/config.py +5 -1
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/gh.py +1 -1
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/gitutil.py +7 -2
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/prdata.py +11 -2
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/test_config.py +2 -0
- gpt-pr-0.6.1/gptpr/version.py +1 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/requirements.txt +4 -4
- gpt-pr-0.5.0/gptpr/version.py +0 -1
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/MANIFEST.in +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/SOURCES.txt +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/dependency_links.txt +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/entry_points.txt +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/not-zip-safe +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gpt_pr.egg-info/top_level.txt +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/__init__.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/checkversion.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/consolecolor.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/main.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/test_checkversion.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/gptpr/test_prdata.py +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/setup.cfg +0 -0
- {gpt-pr-0.5.0 → gpt-pr-0.6.1}/setup.py +0 -0
|
@@ -4,6 +4,61 @@ GPT-PR is an open-source command-line tool designed to streamline your GitHub wo
|
|
|
4
4
|
|
|
5
5
|
[](https://asciinema.org/a/u0PwZlNjAGZcdXPPrjf84wj2A)
|
|
6
6
|
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
For a more detailed explanation, see [Installation](#installation) and [Configuration](#configuration).
|
|
10
|
+
|
|
11
|
+
### 1. Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install -U gpt-pr
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If you don't have the `pip` command available, follow [these instructions](https://pip.pypa.io/en/stable/installation/) to install it on different platforms.
|
|
18
|
+
|
|
19
|
+
### 2. Fill OpenAI API Key
|
|
20
|
+
|
|
21
|
+
1. Go to [OpenAI API Keys](https://platform.openai.com/api-keys) and generate a new key.
|
|
22
|
+
2. Run the following command to fill your key in GPT-PR (it will be stored in `~/.gpt-pr.ini`):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
gpt-pr-config set openai_api_key MY-API-KEY-VALUE
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Generate a GitHub GH Token to Open PRs
|
|
29
|
+
|
|
30
|
+
1. Go to [GitHub Settings](https://github.com/settings/tokens), choose `Generate new token (classic)`, and select all permissions under `repo` (full control of private repositories).
|
|
31
|
+
2. Run the following command to fill your GH token (it will also be stored in `~/.gpt-pr.ini`):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
gpt-pr-config set gh_token MY-GH-TOKEN-VALUE
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 4. Ready to NEVER WRITE A PR AGAIN
|
|
38
|
+
|
|
39
|
+
1. Make your changes, commit them, and push to origin (important!).
|
|
40
|
+
2. Run the following command in your project directory:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
gpt-pr
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. Answer the questions. At the end, you'll receive the URL of a freshly opened PR.
|
|
47
|
+
|
|
48
|
+
## Contributing and Feedback
|
|
49
|
+
|
|
50
|
+
We welcome your contributions and feedback to help improve GPT-PR! Here’s how you can get involved:
|
|
51
|
+
|
|
52
|
+
### Open Issues
|
|
53
|
+
|
|
54
|
+
- **Feature Requests**: Have an idea for a new feature? We’d love to hear it! Open an issue to request new features or enhancements.
|
|
55
|
+
- **Bug Reports**: Encountered a bug? Let us know by opening an issue with detailed information so we can fix it.
|
|
56
|
+
- **General Feedback**: Any other suggestions or feedback? Feel free to share your thoughts.
|
|
57
|
+
|
|
58
|
+
To open an issue, go to the [Issues](https://github.com/your-repo/gpt-pr/issues) section of our GitHub repository. Your contributions are very welcome and highly appreciated!
|
|
59
|
+
|
|
60
|
+
More details about it at our [CONTRIBUTING](./CONTRIBUTING.md) guide.
|
|
61
|
+
|
|
7
62
|
## Table of Contents
|
|
8
63
|
|
|
9
64
|
- [Features](#features)
|
|
@@ -126,6 +181,16 @@ Or just export it as an environment variable in your shell initializer:
|
|
|
126
181
|
export OPENAI_API_KEY=your_generated_api_key_here
|
|
127
182
|
```
|
|
128
183
|
|
|
184
|
+
### Setting Max Input LLM Tokens
|
|
185
|
+
|
|
186
|
+
You can adjust the maximum number of input tokens allowed when calling the LLM model by modifying the corresponding setting.
|
|
187
|
+
|
|
188
|
+
For example, to change the maximum to 20,000 tokens, use the following command:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
gpt-pr-config set input_max_tokens 20000
|
|
192
|
+
```
|
|
193
|
+
|
|
129
194
|
### Change OpenAI model
|
|
130
195
|
|
|
131
196
|
To change OpenAI model, just run:
|
|
@@ -138,12 +203,22 @@ gpt-pr-config set openai_model gpt-4o-mini
|
|
|
138
203
|
|
|
139
204
|
To see a full list of available models, access [OpenAI Models Documentation](https://platform.openai.com/docs/models)
|
|
140
205
|
|
|
206
|
+
### GPT-PR Library Signature in PRs
|
|
207
|
+
|
|
208
|
+
To help other developers recognize and understand the use of the GPT-PR library in generating pull requests, we have included an optional signature feature. By default, this feature is enabled and appends the text "Generated by GPT-PR" at the end of each pull request. This transparency fosters better collaboration and awareness among team members about the tools being utilized in the development process.
|
|
209
|
+
|
|
210
|
+
If you prefer to disable this feature, simply run the following command:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
gpt-pr-config set add_tool_signature false
|
|
214
|
+
```
|
|
215
|
+
|
|
141
216
|
### Reset config
|
|
142
217
|
|
|
143
218
|
To reset any config to default value, just run:
|
|
144
219
|
|
|
145
220
|
```bash
|
|
146
|
-
gpt-pr-config reset
|
|
221
|
+
gpt-pr-config reset config_name
|
|
147
222
|
```
|
|
148
223
|
|
|
149
224
|
Example:
|
|
@@ -179,10 +254,6 @@ gpt-pr -h
|
|
|
179
254
|
Output:
|
|
180
255
|

|
|
181
256
|
|
|
182
|
-
## How to contribute?
|
|
183
|
-
|
|
184
|
-
Please follow our [CONTRIBUTING](./CONTRIBUTING.md) guide.
|
|
185
|
-
|
|
186
257
|
## Roadmap
|
|
187
258
|
|
|
188
259
|
- [x] Improve execution method, possibly through a shell script or at least an alias in bash rc files.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
cffi==1.15.1
|
|
2
|
-
cryptography==43.0.
|
|
2
|
+
cryptography==43.0.1
|
|
3
3
|
fire==0.6.0
|
|
4
4
|
pycparser==2.21
|
|
5
5
|
wcwidth==0.2.13
|
|
@@ -26,12 +26,10 @@ six==1.16.0
|
|
|
26
26
|
[:python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"]
|
|
27
27
|
deprecated==1.2.14
|
|
28
28
|
|
|
29
|
-
[:python_version >= "3.5"]
|
|
30
|
-
idna==3.7
|
|
31
|
-
|
|
32
29
|
[:python_version >= "3.6"]
|
|
33
|
-
certifi==2024.
|
|
30
|
+
certifi==2024.8.30
|
|
34
31
|
distro==1.9.0
|
|
32
|
+
idna==3.8
|
|
35
33
|
pynacl==1.5.0
|
|
36
34
|
wrapt==1.16.0
|
|
37
35
|
|
|
@@ -51,7 +49,7 @@ requests==2.31.0
|
|
|
51
49
|
smmap==5.0.1
|
|
52
50
|
sniffio==1.3.1
|
|
53
51
|
termcolor==2.3.0
|
|
54
|
-
tqdm==4.66.
|
|
52
|
+
tqdm==4.66.5
|
|
55
53
|
typing-extensions==4.7.1
|
|
56
54
|
urllib3==2.0.7
|
|
57
55
|
zipp==3.15.0
|
|
@@ -7,7 +7,8 @@ def config_command_example(name, value_sample):
|
|
|
7
7
|
return f'gpt-pr-config set {name} {value_sample}'
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
CONFIG_PROJECT_REPO_URL = 'https://github.com/alissonperez/gpt-pr'
|
|
11
|
+
CONFIG_README_SECTION = f'{CONFIG_PROJECT_REPO_URL}?tab=readme-ov-file#configuration'
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class Config:
|
|
@@ -15,6 +16,9 @@ class Config:
|
|
|
15
16
|
config_filename = '.gpt-pr.ini'
|
|
16
17
|
|
|
17
18
|
_default_config = {
|
|
19
|
+
# Amenities
|
|
20
|
+
'ADD_TOOL_SIGNATURE': 'true', # Add GPT-PR signature to PRs
|
|
21
|
+
|
|
18
22
|
# Github
|
|
19
23
|
'GH_TOKEN': '',
|
|
20
24
|
|
|
@@ -30,7 +30,7 @@ def create_pr(pr_data, yield_confirmation):
|
|
|
30
30
|
default=True).execute()
|
|
31
31
|
|
|
32
32
|
if pr_confirmation:
|
|
33
|
-
pr = repo.create_pull(title=pr_data.title, body=pr_data.
|
|
33
|
+
pr = repo.create_pull(title=pr_data.title, body=pr_data.create_body(),
|
|
34
34
|
head=pr_data.branch_info.branch, base=pr_data.branch_info.base_branch)
|
|
35
35
|
print("Pull request created successfully: ", pr.html_url)
|
|
36
36
|
else:
|
|
@@ -183,10 +183,15 @@ def _get_stats(repo, base_branch, branch):
|
|
|
183
183
|
continue
|
|
184
184
|
|
|
185
185
|
line = line.split('\t')
|
|
186
|
+
|
|
187
|
+
# Binary files will not have stats (just "-")
|
|
188
|
+
added = int(line[0]) if line[0] and line[0].isdigit() else 0
|
|
189
|
+
removed = int(line[1]) if line[1] and line[1].isdigit() else 0
|
|
190
|
+
|
|
186
191
|
files_changed.append(FileChange(
|
|
187
192
|
file_path=line[2],
|
|
188
|
-
lines_added=
|
|
189
|
-
lines_removed=
|
|
193
|
+
lines_added=added,
|
|
194
|
+
lines_removed=removed
|
|
190
195
|
))
|
|
191
196
|
|
|
192
197
|
return files_changed
|
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
from openai import OpenAI
|
|
5
5
|
|
|
6
6
|
from gptpr.gitutil import BranchInfo
|
|
7
|
-
from gptpr.config import config
|
|
7
|
+
from gptpr.config import config, CONFIG_PROJECT_REPO_URL
|
|
8
8
|
import gptpr.consolecolor as cc
|
|
9
9
|
|
|
10
10
|
TOKENIZER_RATIO = 4
|
|
@@ -67,9 +67,18 @@ class PrData():
|
|
|
67
67
|
f'{cc.bold("Title")}: {cc.yellow(self.title)}',
|
|
68
68
|
f'{cc.bold("Branch name")}: {cc.yellow(self.branch_info.branch)}',
|
|
69
69
|
f'{cc.bold("Base branch")}: {cc.yellow(self.branch_info.base_branch)}',
|
|
70
|
-
f'{cc.bold("PR Description")}:\n{self.
|
|
70
|
+
f'{cc.bold("PR Description")}:\n{self.create_body()}',
|
|
71
71
|
])
|
|
72
72
|
|
|
73
|
+
def create_body(self):
|
|
74
|
+
body = self.body
|
|
75
|
+
|
|
76
|
+
if config.get_user_config('ADD_TOOL_SIGNATURE') == 'true':
|
|
77
|
+
pr_signature = f'Generated by [GPT-PR]({CONFIG_PROJECT_REPO_URL})'
|
|
78
|
+
body += '\n\n---\n\n' + pr_signature
|
|
79
|
+
|
|
80
|
+
return body
|
|
81
|
+
|
|
73
82
|
|
|
74
83
|
functions = [
|
|
75
84
|
{
|
|
@@ -87,10 +87,12 @@ def test_all_values(temp_config):
|
|
|
87
87
|
all_values = config.all_values()
|
|
88
88
|
|
|
89
89
|
assert all_values == [
|
|
90
|
+
('DEFAULT', 'add_tool_signature', 'true'),
|
|
90
91
|
('DEFAULT', 'gh_token', ''),
|
|
91
92
|
('DEFAULT', 'input_max_tokens', '15000'),
|
|
92
93
|
('DEFAULT', 'openai_model', 'gpt-4o-mini'),
|
|
93
94
|
('DEFAULT', 'openai_api_key', ''),
|
|
95
|
+
('user', 'add_tool_signature', 'true'),
|
|
94
96
|
('user', 'gh_token', ''),
|
|
95
97
|
('user', 'input_max_tokens', '15000'),
|
|
96
98
|
('user', 'openai_model', 'gpt-4o-mini'),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.1"
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
annotated-types==0.5.0; python_version >= '3.7'
|
|
3
3
|
anyio==3.7.1; python_version >= '3.7'
|
|
4
4
|
cached-property==1.5.2; python_version < '3.8'
|
|
5
|
-
certifi==2024.
|
|
5
|
+
certifi==2024.8.30; python_version >= '3.6'
|
|
6
6
|
cffi==1.15.1
|
|
7
7
|
charset-normalizer==3.3.2; python_full_version >= '3.7.0'
|
|
8
|
-
cryptography==43.0.
|
|
8
|
+
cryptography==43.0.1
|
|
9
9
|
deprecated==1.2.14; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
|
10
10
|
distro==1.9.0; python_version >= '3.6'
|
|
11
11
|
exceptiongroup==1.2.2; python_version < '3.11'
|
|
@@ -15,7 +15,7 @@ gitpython==3.1.42; python_version >= '3.7'
|
|
|
15
15
|
h11==0.14.0; python_version >= '3.7'
|
|
16
16
|
httpcore==0.17.3; python_version >= '3.7'
|
|
17
17
|
httpx==0.24.1; python_version >= '3.7'
|
|
18
|
-
idna==3.
|
|
18
|
+
idna==3.8; python_version >= '3.6'
|
|
19
19
|
importlib-metadata==6.7.0; python_version == '3.7'
|
|
20
20
|
inquirerpy==0.3.4; python_version >= '3.7' and python_version < '4.0'
|
|
21
21
|
openai==1.14.0; python_full_version >= '3.7.1'
|
|
@@ -32,7 +32,7 @@ six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'
|
|
|
32
32
|
smmap==5.0.1; python_version >= '3.7'
|
|
33
33
|
sniffio==1.3.1; python_version >= '3.7'
|
|
34
34
|
termcolor==2.3.0; python_version >= '3.7'
|
|
35
|
-
tqdm==4.66.
|
|
35
|
+
tqdm==4.66.5; python_version >= '3.7'
|
|
36
36
|
typing-extensions==4.7.1; python_version >= '3.7'
|
|
37
37
|
urllib3==2.0.7; python_version >= '3.7'
|
|
38
38
|
wcwidth==0.2.13
|
gpt-pr-0.5.0/gptpr/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|