gpt-pr 0.0.3__tar.gz → 0.1.0__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.0.3 → gpt-pr-0.1.0}/PKG-INFO +1 -1
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/README.md +3 -1
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/PKG-INFO +1 -1
- gpt-pr-0.1.0/gptpr/__version__.py +1 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/prdata.py +27 -4
- gpt-pr-0.0.3/gptpr/__version__.py +0 -1
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/MANIFEST.in +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/SOURCES.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/dependency_links.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/entry_points.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/not-zip-safe +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/requires.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gpt_pr.egg-info/top_level.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/__init__.py +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/consolecolor.py +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/gh.py +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/gitutil.py +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/gptpr/main.py +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/requirements.txt +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/setup.cfg +0 -0
- {gpt-pr-0.0.3 → gpt-pr-0.1.0}/setup.py +0 -0
|
@@ -35,9 +35,11 @@ You can install and use GPT-PR in one of two ways. Choose the option that best s
|
|
|
35
35
|
1. Install the package:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
pip install gpt-pr
|
|
38
|
+
pip install -U gpt-pr
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
> Note: Use this command to **update** gpt-pr package to the latest version.
|
|
42
|
+
|
|
41
43
|
2. Export API keys as environment variables ([Authentication & API Keys](#authentication--api-keys)).
|
|
42
44
|
|
|
43
45
|
3. Inside the Git repository you are working on, ensure you have pushed your branch to origin, then run:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.1.0'
|
|
@@ -18,9 +18,32 @@ if not OPENAI_API_KEY:
|
|
|
18
18
|
|
|
19
19
|
openai.api_key = OPENAI_API_KEY
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
DEFAULT_PR_TEMPLATE = ('### Ref. [Link]\n\n## What was done?\n[Fill here]\n\n'
|
|
22
|
+
'## How was it done?\n[Fill here]\n\n'
|
|
23
|
+
'## How was it tested?\n[Fill here with test information from diff content or commits]')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_pr_template():
|
|
27
|
+
pr_template = DEFAULT_PR_TEMPLATE
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
github_dir = os.path.join(os.getcwd(), '.github')
|
|
31
|
+
github_files = os.listdir(github_dir)
|
|
32
|
+
pr_template_file = [f for f in github_files if f.lower().startswith('pull_request_template')][0]
|
|
33
|
+
pr_template_file_path = os.path.join(github_dir, pr_template_file)
|
|
34
|
+
|
|
35
|
+
with open(pr_template_file_path, 'r') as f:
|
|
36
|
+
local_pr_template = f.read()
|
|
37
|
+
|
|
38
|
+
if local_pr_template.strip() != '':
|
|
39
|
+
print('Found PR template at:', pr_template_file_path)
|
|
40
|
+
pr_template = local_pr_template
|
|
41
|
+
else:
|
|
42
|
+
print('Empty PR template at:', pr_template_file_path, 'using default template.')
|
|
43
|
+
except Exception:
|
|
44
|
+
print('PR template not found in .github dir. Using default template.')
|
|
45
|
+
|
|
46
|
+
return pr_template
|
|
24
47
|
|
|
25
48
|
|
|
26
49
|
@dataclass
|
|
@@ -80,7 +103,7 @@ def get_pr_data(branch_info):
|
|
|
80
103
|
else:
|
|
81
104
|
messages.append({'role': 'user', 'content': 'git commits: ' + '\n'.join(branch_info.commits)})
|
|
82
105
|
|
|
83
|
-
messages.append({'role': 'user', 'content': 'PR template:\n' +
|
|
106
|
+
messages.append({'role': 'user', 'content': 'PR template:\n' + get_pr_template()})
|
|
84
107
|
|
|
85
108
|
current_total_length = sum([len(m['content']) for m in messages])
|
|
86
109
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.0.3'
|
|
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
|
|
File without changes
|