gpt-pr 0.6.0__tar.gz → 0.7.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.6.0
3
+ Version: 0.7.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
@@ -4,6 +4,61 @@ GPT-PR is an open-source command-line tool designed to streamline your GitHub wo
4
4
 
5
5
  [![asciicast](https://asciinema.org/a/u0PwZlNjAGZcdXPPrjf84wj2A.svg)](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)
@@ -199,10 +254,6 @@ gpt-pr -h
199
254
  Output:
200
255
  ![image](https://github.com/alissonperez/gpt-pr/assets/756802/cc6c0ca4-5759-44ce-ad35-e4e7305b3875)
201
256
 
202
- ## How to contribute?
203
-
204
- Please follow our [CONTRIBUTING](./CONTRIBUTING.md) guide.
205
-
206
257
  ## Roadmap
207
258
 
208
259
  - [x] Improve execution method, possibly through a shell script or at least an alias in bash rc files.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.6.0
3
+ Version: 0.7.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
@@ -1,11 +1,11 @@
1
1
  cffi==1.15.1
2
- cryptography==43.0.0
2
+ cryptography==43.0.3
3
3
  fire==0.6.0
4
4
  pycparser==2.21
5
5
  wcwidth==0.2.13
6
6
 
7
7
  [:python_full_version >= "3.7.0"]
8
- charset-normalizer==3.3.2
8
+ charset-normalizer==3.4.0
9
9
  prompt-toolkit==3.0.43
10
10
 
11
11
  [:python_full_version >= "3.7.1"]
@@ -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.7.4
30
+ certifi==2024.8.30
34
31
  distro==1.9.0
32
+ idna==3.10
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.4
52
+ tqdm==4.67.0
55
53
  typing-extensions==4.7.1
56
54
  urllib3==2.0.7
57
55
  zipp==3.15.0
@@ -32,7 +32,7 @@ class FileChange:
32
32
  return f'{self.file_path} (+{(self.lines_added)} -{self.lines_removed})'
33
33
 
34
34
 
35
- def get_branch_info(base_branch, yield_confirmation):
35
+ def get_branch_info(base_branch, origin, yield_confirmation):
36
36
  # Get current directory
37
37
  current_dir = os.getcwd()
38
38
 
@@ -57,7 +57,7 @@ def get_branch_info(base_branch, yield_confirmation):
57
57
  if not _branch_exists(repo, base_branch):
58
58
  raise Exception(f'Base branch {base_branch} does not exist.')
59
59
 
60
- owner, repo_name = _get_remote_info(repo)
60
+ owner, repo_name = _get_remote_info(repo, origin)
61
61
 
62
62
  commits = _get_diff_messages_against_base_branch(repo, current_branch.name, base_branch)
63
63
  commits = _get_valid_commits(commits, yield_confirmation)
@@ -125,9 +125,9 @@ def _get_highlight_commits(commits, yield_confirmation):
125
125
  return highlight_commits
126
126
 
127
127
 
128
- def _get_remote_info(repo):
128
+ def _get_remote_info(repo, origin):
129
129
  for remote in repo.remotes:
130
- if remote.name != 'origin':
130
+ if remote.name != origin:
131
131
  continue
132
132
 
133
133
  remote_urls_joined = ','.join([str(url) for url in remote.urls])
@@ -137,7 +137,7 @@ def _get_remote_info(repo):
137
137
  for url in remote.urls:
138
138
  return _extract_owner_and_repo(url)
139
139
 
140
- raise Exception('Could not find origin remote.')
140
+ raise Exception(f'Could not find \'{origin}\' remote.')
141
141
 
142
142
 
143
143
  def _extract_owner_and_repo(repo_url):
@@ -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=int(line[0]),
189
- lines_removed=int(line[1])
193
+ lines_added=added,
194
+ lines_removed=removed
190
195
  ))
191
196
 
192
197
  return files_changed
@@ -10,7 +10,7 @@ from gptpr import consolecolor as cc
10
10
  from gptpr.checkversion import check_for_updates
11
11
 
12
12
 
13
- def run(base_branch='main', yield_confirmation=False, version=False):
13
+ def run(base_branch='main', origin='origin', yield_confirmation=False, version=False):
14
14
  '''
15
15
  Create Pull Requests from current branch with base branch (default 'main' branch)
16
16
  '''
@@ -19,7 +19,7 @@ def run(base_branch='main', yield_confirmation=False, version=False):
19
19
  print('Current version:', __version__)
20
20
  return
21
21
 
22
- branch_info = get_branch_info(base_branch, yield_confirmation)
22
+ branch_info = get_branch_info(base_branch, origin, yield_confirmation)
23
23
 
24
24
  if not branch_info:
25
25
  exit(0)
@@ -0,0 +1 @@
1
+ __version__ = "0.7.0"
@@ -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.7.4; python_version >= '3.6'
5
+ certifi==2024.8.30; python_version >= '3.6'
6
6
  cffi==1.15.1
7
- charset-normalizer==3.3.2; python_full_version >= '3.7.0'
8
- cryptography==43.0.0
7
+ charset-normalizer==3.4.0; python_full_version >= '3.7.0'
8
+ cryptography==43.0.3
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.7; python_version >= '3.5'
18
+ idna==3.10; 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.4; python_version >= '3.7'
35
+ tqdm==4.67.0; 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
@@ -1 +0,0 @@
1
- __version__ = "0.6.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