gpt-pr 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.2.0
3
+ Version: 0.2.1
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
@@ -17,6 +17,7 @@ Requires-Dist: prompt-toolkit ==3.0.43 ; python_full_version >= "3.7.0"
17
17
  Requires-Dist: openai ==1.14.0 ; python_full_version >= "3.7.1"
18
18
  Requires-Dist: exceptiongroup ==1.2.0 ; python_version < "3.11"
19
19
  Requires-Dist: cached-property ==1.5.2 ; python_version < "3.8"
20
+ Requires-Dist: typing-extensions ==4.7.1 ; python_version < "3.8"
20
21
  Requires-Dist: importlib-metadata ==6.7.0 ; python_version == "3.7"
21
22
  Requires-Dist: six ==1.16.0 ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2"
22
23
  Requires-Dist: deprecated ==1.2.14 ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
@@ -41,7 +42,6 @@ Requires-Dist: smmap ==5.0.1 ; python_version >= "3.7"
41
42
  Requires-Dist: sniffio ==1.3.1 ; python_version >= "3.7"
42
43
  Requires-Dist: termcolor ==2.3.0 ; python_version >= "3.7"
43
44
  Requires-Dist: tqdm ==4.66.2 ; python_version >= "3.7"
44
- Requires-Dist: typing-extensions ==4.7.1 ; python_version >= "3.7"
45
45
  Requires-Dist: urllib3 ==2.0.7 ; python_version >= "3.7"
46
46
  Requires-Dist: zipp ==3.15.0 ; python_version >= "3.7"
47
47
  Requires-Dist: inquirerpy ==0.3.4 ; python_version >= "3.7" and python_version < "4.0"
@@ -0,0 +1,13 @@
1
+ gptpr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ gptpr/consolecolor.py,sha256=_JmBMNjIflWMlgP2VkCWu6uQLR9oHBy52uV3TRJJgF4,800
3
+ gptpr/gh.py,sha256=aunn_8wi4pGoGkjdqyA2MZVAAxfItpnnmDCp20-i-WA,786
4
+ gptpr/gitutil.py,sha256=NBD3iRnbFEPRU47w7c5TowwtZieDYkU4zybvv0PoOU0,5783
5
+ gptpr/main.py,sha256=rkalqLcc1Nh5WH51w7ayEMIYNoScrRBNVYl3KLuZFdY,1270
6
+ gptpr/prdata.py,sha256=y4VodgCiSaARPXzJHsg32-cqrR_nZqyyGSLij6ee-oo,5846
7
+ gptpr/test_prdata.py,sha256=rSJ-yqOdw-iYdBWyqnA2SXbdrhT8KgIkRTTf9SY1S1g,474
8
+ gptpr/version.py,sha256=HfjVOrpTnmZ-xVFCYSVmX50EXaBQeJteUHG-PD6iQs8,22
9
+ gpt_pr-0.2.1.dist-info/METADATA,sha256=rJ-4clCl3pJh99vscyuuVQsLt4XQzqpgf4K67YYMZJY,2637
10
+ gpt_pr-0.2.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
11
+ gpt_pr-0.2.1.dist-info/entry_points.txt,sha256=aXCkyNdoUHfSJXVhRKHj8m09twDfcDmY7xC66u5N3hE,43
12
+ gpt_pr-0.2.1.dist-info/top_level.txt,sha256=DZcbzlsjh4BD8njGcvhOeCZ83U_oYWgCn0w8qx5--04,6
13
+ gpt_pr-0.2.1.dist-info/RECORD,,
gptpr/gh.py CHANGED
@@ -21,7 +21,7 @@ def create_pr(pr_data, yield_confirmation):
21
21
 
22
22
  if pr_confirmation:
23
23
  pr = repo.create_pull(title=pr_data.title, body=pr_data.body,
24
- head=pr_data.branch_info.branch, base='main')
24
+ head=pr_data.branch_info.branch, base=pr_data.branch_info.base_branch)
25
25
  print("Pull request created successfully: ", pr.html_url)
26
26
  else:
27
27
  print('cancelling...')
gptpr/gitutil.py CHANGED
@@ -10,6 +10,7 @@ from InquirerPy.base.control import Choice
10
10
  class BranchInfo:
11
11
  owner: str
12
12
  repo: str
13
+ base_branch: str
13
14
  branch: str
14
15
  commits: list
15
16
  highlight_commits: list
@@ -70,10 +71,11 @@ def get_branch_info(base_branch, yield_confirmation):
70
71
  return BranchInfo(
71
72
  owner=owner,
72
73
  repo=repo_name,
74
+ base_branch=base_branch,
73
75
  branch=current_branch.name,
74
76
  commits=commits,
75
77
  highlight_commits=highlight_commits,
76
- diff=_get_diff_changes(repo, current_branch.name, yield_confirmation)
78
+ diff=_get_diff_changes(repo, base_branch, current_branch.name, yield_confirmation)
77
79
  )
78
80
 
79
81
 
@@ -85,7 +87,7 @@ def _branch_exists(repo, branch_name):
85
87
 
86
88
 
87
89
  def _get_diff_messages_against_base_branch(repo, branch, base_branch):
88
- # Get commit messages that are in the current branch but not in the main branch
90
+ # Get commit messages that are in the current branch but not in the base branch
89
91
  commits_diff = list(repo.iter_commits(f'{base_branch}..{branch}'))
90
92
 
91
93
  return [commit.message.strip('\n') for commit in commits_diff]
@@ -147,33 +149,33 @@ def _extract_owner_and_repo(repo_url):
147
149
  return owner, '.'.join(repo_info.split('.')[:-1])
148
150
 
149
151
 
150
- def _get_diff_changes(repo, branch, yield_confirmation):
152
+ def _get_diff_changes(repo, base_branch, branch, yield_confirmation):
151
153
  diff_changes = []
152
154
 
153
- stats = _get_stats(repo, branch)
155
+ stats = _get_stats(repo, base_branch, branch)
154
156
  files_to_ignore = _get_files_to_ignore(stats, yield_confirmation)
155
157
 
156
158
  for file_change in stats:
157
159
  if file_change.file_path in files_to_ignore:
158
160
  continue
159
161
 
160
- file_diff = repo.git.diff('main', branch, '--', file_change.file_path)
162
+ file_diff = repo.git.diff(base_branch, branch, '--', file_change.file_path)
161
163
 
162
164
  diff_changes.append(file_diff)
163
165
 
164
166
  return '\n'.join(diff_changes)
165
167
 
166
168
 
167
- def _get_stats(repo, branch):
169
+ def _get_stats(repo, base_branch, branch):
168
170
  '''
169
- Get the stats of the difference between the current branch and the main branch
171
+ Get the stats of the difference between the current branch and the base branch
170
172
  '''
171
173
 
172
174
  # returns:
173
175
  # 4 0 README.md
174
176
  # 2 0 application/aggregator/aggregator.go
175
177
  # 0 257 go.sum
176
- diff_index = repo.git.diff('main', branch, '--numstat')
178
+ diff_index = repo.git.diff(base_branch, branch, '--numstat')
177
179
 
178
180
  files_changed = []
179
181
  for line in diff_index.split('\n'):
gptpr/prdata.py CHANGED
@@ -48,7 +48,7 @@ class PrData():
48
48
  f'{cc.bold("Repository")}: {cc.yellow(self.branch_info.owner)}/{cc.yellow(self.branch_info.repo)}',
49
49
  f'{cc.bold("Title")}: {cc.yellow(self.title)}',
50
50
  f'{cc.bold("Branch name")}: {cc.yellow(self.branch_info.branch)}',
51
- f'{cc.bold("Base branch")}: {cc.yellow("main")}',
51
+ f'{cc.bold("Base branch")}: {cc.yellow(self.branch_info.base_branch)}',
52
52
  f'{cc.bold("PR Description")}:\n{self.body}',
53
53
  ])
54
54
 
gptpr/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.0"
1
+ __version__ = "0.2.1"
@@ -1,13 +0,0 @@
1
- gptpr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- gptpr/consolecolor.py,sha256=_JmBMNjIflWMlgP2VkCWu6uQLR9oHBy52uV3TRJJgF4,800
3
- gptpr/gh.py,sha256=y8JgWYTzYzjOWitkEK9Lshjmuv1gV7Tt4DHBrISxAJM,761
4
- gptpr/gitutil.py,sha256=uhNwwH3r84p5GK1j_19sZEPMyfftEiGpzuV6QZSW6qE,5667
5
- gptpr/main.py,sha256=rkalqLcc1Nh5WH51w7ayEMIYNoScrRBNVYl3KLuZFdY,1270
6
- gptpr/prdata.py,sha256=RErSbUyIb0LxCjlUS4KKHoNi2WN94NRO3Cw0mCxtHiU,5824
7
- gptpr/test_prdata.py,sha256=rSJ-yqOdw-iYdBWyqnA2SXbdrhT8KgIkRTTf9SY1S1g,474
8
- gptpr/version.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,22
9
- gpt_pr-0.2.0.dist-info/METADATA,sha256=oLLwZT78ZD4ymXo5rABD0L_vI8zbJlidiKOu4OzkaNg,2638
10
- gpt_pr-0.2.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
11
- gpt_pr-0.2.0.dist-info/entry_points.txt,sha256=aXCkyNdoUHfSJXVhRKHj8m09twDfcDmY7xC66u5N3hE,43
12
- gpt_pr-0.2.0.dist-info/top_level.txt,sha256=DZcbzlsjh4BD8njGcvhOeCZ83U_oYWgCn0w8qx5--04,6
13
- gpt_pr-0.2.0.dist-info/RECORD,,
File without changes