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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.0.3
3
+ Version: 0.1.0
4
4
  Summary: Automate your GitHub workflow with GPT-PR: an OpenAI powered library for streamlined PR generation.
5
5
  Home-page: http://github.com/alissonperez/gpt-pr
6
6
  Author: Alisson R. Perez
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.0.3
3
+ Version: 0.1.0
4
4
  Summary: Automate your GitHub workflow with GPT-PR: an OpenAI powered library for streamlined PR generation.
5
5
  Home-page: http://github.com/alissonperez/gpt-pr
6
6
  Author: Alisson R. Perez
@@ -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
- 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]')
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' + pr_template})
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