gpt-pr 0.7.0__py3-none-any.whl → 0.7.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.

Potentially problematic release.


This version of gpt-pr might be problematic. Click here for more details.

@@ -3,12 +3,12 @@ import configparser
3
3
 
4
4
  from pytest import fixture
5
5
 
6
- from gptpr.config import Config
6
+ from gpt_pr.config import Config
7
7
 
8
8
 
9
9
  @fixture
10
10
  def temp_config(tmpdir):
11
- temp_dir = tmpdir.mkdir('config_dir')
11
+ temp_dir = tmpdir.mkdir("config_dir")
12
12
  config = Config(temp_dir)
13
13
  return config, temp_dir
14
14
 
@@ -29,10 +29,14 @@ def test_init_config_file(temp_config):
29
29
  # Check if the file exists
30
30
  assert os.path.isfile(os.path.join(str(temp_dir), config.config_filename))
31
31
 
32
- _check_config(config, temp_dir, [
33
- ('DEFAULT', 'OPENAI_MODEL', 'gpt-4o-mini'),
34
- ('DEFAULT', 'OPENAI_API_KEY', ''),
35
- ])
32
+ _check_config(
33
+ config,
34
+ temp_dir,
35
+ [
36
+ ("DEFAULT", "OPENAI_MODEL", "gpt-4o-mini"),
37
+ ("DEFAULT", "OPENAI_API_KEY", ""),
38
+ ],
39
+ )
36
40
 
37
41
 
38
42
  def test_new_default_value_should_be_added(temp_config):
@@ -42,43 +46,55 @@ def test_new_default_value_should_be_added(temp_config):
42
46
  new_config = Config(temp_dir)
43
47
 
44
48
  # Add a new default value
45
- new_config.default_config['NEW_DEFAULT'] = 'new_default_value'
49
+ new_config.default_config["NEW_DEFAULT"] = "new_default_value"
46
50
  new_config.load() # Should update config file...
47
51
 
48
- _check_config(new_config, temp_dir, [
49
- ('DEFAULT', 'NEW_DEFAULT', 'new_default_value'),
50
- ])
52
+ _check_config(
53
+ new_config,
54
+ temp_dir,
55
+ [
56
+ ("DEFAULT", "NEW_DEFAULT", "new_default_value"),
57
+ ],
58
+ )
51
59
 
52
60
 
53
61
  def test_set_user_config(temp_config):
54
62
  config, temp_dir = temp_config
55
63
 
56
- config.set_user_config('OPENAI_MODEL', 'gpt-3.5')
64
+ config.set_user_config("OPENAI_MODEL", "gpt-3.5")
57
65
  config.persist()
58
66
 
59
67
  # Read the configuration file and verify its contents
60
68
  config_to_test = configparser.ConfigParser()
61
69
  config_to_test.read(os.path.join(str(temp_dir), config.config_filename))
62
70
 
63
- _check_config(config, temp_dir, [
64
- ('user', 'OPENAI_MODEL', 'gpt-3.5'),
65
- ('user', 'OPENAI_API_KEY', ''),
66
- ])
71
+ _check_config(
72
+ config,
73
+ temp_dir,
74
+ [
75
+ ("user", "OPENAI_MODEL", "gpt-3.5"),
76
+ ("user", "OPENAI_API_KEY", ""),
77
+ ],
78
+ )
67
79
 
68
80
 
69
81
  def test_set_user_config_with_int_value(temp_config):
70
82
  config, temp_dir = temp_config
71
83
 
72
- config.set_user_config('INPUT_MAX_TOKENS', 100)
84
+ config.set_user_config("INPUT_MAX_TOKENS", 100)
73
85
  config.persist()
74
86
 
75
87
  # Read the configuration file and verify its contents
76
88
  config_to_test = configparser.ConfigParser()
77
89
  config_to_test.read(os.path.join(str(temp_dir), config.config_filename))
78
90
 
79
- _check_config(config, temp_dir, [
80
- ('user', 'INPUT_MAX_TOKENS', '100'),
81
- ])
91
+ _check_config(
92
+ config,
93
+ temp_dir,
94
+ [
95
+ ("user", "INPUT_MAX_TOKENS", "100"),
96
+ ],
97
+ )
82
98
 
83
99
 
84
100
  def test_all_values(temp_config):
@@ -87,32 +103,36 @@ def test_all_values(temp_config):
87
103
  all_values = config.all_values()
88
104
 
89
105
  assert all_values == [
90
- ('DEFAULT', 'add_tool_signature', 'true'),
91
- ('DEFAULT', 'gh_token', ''),
92
- ('DEFAULT', 'input_max_tokens', '15000'),
93
- ('DEFAULT', 'openai_model', 'gpt-4o-mini'),
94
- ('DEFAULT', 'openai_api_key', ''),
95
- ('user', 'add_tool_signature', 'true'),
96
- ('user', 'gh_token', ''),
97
- ('user', 'input_max_tokens', '15000'),
98
- ('user', 'openai_model', 'gpt-4o-mini'),
99
- ('user', 'openai_api_key', ''),
106
+ ("DEFAULT", "add_tool_signature", "true"),
107
+ ("DEFAULT", "gh_token", ""),
108
+ ("DEFAULT", "input_max_tokens", "15000"),
109
+ ("DEFAULT", "openai_model", "gpt-4o-mini"),
110
+ ("DEFAULT", "openai_api_key", ""),
111
+ ("user", "add_tool_signature", "true"),
112
+ ("user", "gh_token", ""),
113
+ ("user", "input_max_tokens", "15000"),
114
+ ("user", "openai_model", "gpt-4o-mini"),
115
+ ("user", "openai_api_key", ""),
100
116
  ]
101
117
 
102
118
 
103
119
  def test_reset_user_config(temp_config):
104
120
  config, temp_dir = temp_config
105
121
 
106
- config.set_user_config('OPENAI_MODEL', 'gpt-3.5')
122
+ config.set_user_config("OPENAI_MODEL", "gpt-3.5")
107
123
  config.persist()
108
124
 
109
- config.reset_user_config('OPENAI_MODEL')
125
+ config.reset_user_config("OPENAI_MODEL")
110
126
 
111
127
  # Read the configuration file and verify its contents
112
128
  config_to_test = configparser.ConfigParser()
113
129
  config_to_test.read(os.path.join(str(temp_dir), config.config_filename))
114
130
 
115
- _check_config(config, temp_dir, [
116
- ('user', 'OPENAI_MODEL', 'gpt-4o-mini'),
117
- ('user', 'OPENAI_API_KEY', ''),
118
- ])
131
+ _check_config(
132
+ config,
133
+ temp_dir,
134
+ [
135
+ ("user", "OPENAI_MODEL", "gpt-4o-mini"),
136
+ ("user", "OPENAI_API_KEY", ""),
137
+ ],
138
+ )
gpt_pr/test_gh.py ADDED
@@ -0,0 +1,60 @@
1
+ from types import SimpleNamespace
2
+ import gpt_pr.gh as gh_module
3
+
4
+
5
+ def test_create_pr_success(mocker, capsys):
6
+ fake_repo = mocker.Mock()
7
+ pr = SimpleNamespace(html_url="http://fake.url")
8
+ fake_repo.create_pull.return_value = pr
9
+
10
+ fake_gh = SimpleNamespace()
11
+ fake_gh.get_repo = lambda repo_name: fake_repo
12
+
13
+ branch_info = SimpleNamespace(
14
+ owner="owner", repo="repo", branch="feature-branch", base_branch="main"
15
+ )
16
+ pr_data = SimpleNamespace(
17
+ title="Test PR", branch_info=branch_info, create_body=lambda: "My body"
18
+ )
19
+
20
+ gh_module.create_pr(pr_data, yield_confirmation=True, gh=fake_gh)
21
+
22
+ fake_repo.create_pull.assert_called_once_with(
23
+ title="Test PR", body="My body", head="feature-branch", base="main"
24
+ )
25
+ captured = capsys.readouterr()
26
+ assert "Pull request created successfully" in captured.out
27
+ assert "http://fake.url" in captured.out
28
+
29
+
30
+ def test_create_pr_cancel(mocker, capsys):
31
+ fake_repo = mocker.Mock()
32
+ fake_gh = SimpleNamespace()
33
+ fake_gh.get_repo = lambda repo_name: fake_repo
34
+
35
+ class FakePrompt:
36
+ def __init__(self, *args, **kwargs):
37
+ pass
38
+
39
+ def execute(self):
40
+ return False
41
+
42
+ mocker.patch.object(
43
+ gh_module.inquirer,
44
+ "confirm",
45
+ lambda *args, **kwargs: FakePrompt(*args, **kwargs),
46
+ )
47
+
48
+ branch_info = SimpleNamespace(
49
+ owner="owner", repo="repo", branch="branch", base_branch="base"
50
+ )
51
+ pr_data = SimpleNamespace(
52
+ title="Cancel PR", branch_info=branch_info, create_body=lambda: "Body"
53
+ )
54
+
55
+ gh_module.create_pr(pr_data, yield_confirmation=False, gh=fake_gh)
56
+
57
+ fake_repo.create_pull.assert_not_called()
58
+ captured = capsys.readouterr()
59
+
60
+ assert "cancelling..." in captured.out
gpt_pr/test_prdata.py ADDED
@@ -0,0 +1,17 @@
1
+ from gpt_pr.prdata import _parse_json
2
+
3
+
4
+ def test_parse_json():
5
+ content = (
6
+ '{\n"title": "feat(dependencies): pin dependencies '
7
+ 'versions",\n"description": "### Ref. [Link]\n\n## What was done? ..."\n}'
8
+ )
9
+
10
+ expected = {
11
+ "title": "feat(dependencies): pin dependencies versions",
12
+ "description": "### Ref. [Link]\n\n## What was done? ...",
13
+ }
14
+
15
+ assert _parse_json(content) == expected, (
16
+ "The function did not return the expected output."
17
+ )
@@ -0,0 +1,286 @@
1
+ Metadata-Version: 2.4
2
+ Name: gpt-pr
3
+ Version: 0.7.1
4
+ Summary: Automate your GitHub workflow with GPT-PR: an OpenAI powered library for streamlined PR generation.
5
+ Author: alissonperez
6
+ Author-email: 756802+alissonperez@users.noreply.github.com
7
+ Requires-Python: >=3.9,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Dist: fire (>=0.7.1,<0.8.0)
16
+ Requires-Dist: gitpython (>=3.1.45,<4.0.0)
17
+ Requires-Dist: inquirerpy (>=0.3.4,<0.4.0)
18
+ Requires-Dist: openai (>=2.5.0,<3.0.0)
19
+ Requires-Dist: prompt-toolkit (>=3.0.52,<4.0.0)
20
+ Requires-Dist: pygithub (>=2.8.1,<3.0.0)
21
+ Requires-Dist: requests (>=2.32.5,<3.0.0)
22
+ Requires-Dist: tiktoken (>=0.12.0,<0.13.0)
23
+ Description-Content-Type: text/markdown
24
+
25
+ # GPT-PR
26
+
27
+ GPT-PR is an open-source command-line tool designed to streamline your GitHub workflow for opening PRs. Leveraging OpenAI's ChatGPT API, it automatically opens a GitHub Pull Request with a predefined description and title directly from your current project directory.
28
+
29
+ [![asciicast](https://asciinema.org/a/u0PwZlNjAGZcdXPPrjf84wj2A.svg)](https://asciinema.org/a/u0PwZlNjAGZcdXPPrjf84wj2A)
30
+
31
+ ## Quick Start
32
+
33
+ For a more detailed explanation, see [Installation](#installation) and [Configuration](#configuration).
34
+
35
+ ### 1. Installation
36
+
37
+ ```bash
38
+ pip install -U gpt-pr
39
+ ```
40
+
41
+ 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.
42
+
43
+ ### 2. Fill OpenAI API Key
44
+
45
+ 1. Go to [OpenAI API Keys](https://platform.openai.com/api-keys) and generate a new key.
46
+ 2. Run the following command to fill your key in GPT-PR (it will be stored in `~/.gpt-pr.ini`):
47
+
48
+ ```bash
49
+ gpt-pr-config set openai_api_key MY-API-KEY-VALUE
50
+ ```
51
+
52
+ ### 3. Generate a GitHub GH Token to Open PRs
53
+
54
+ 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).
55
+ 2. Run the following command to fill your GH token (it will also be stored in `~/.gpt-pr.ini`):
56
+
57
+ ```bash
58
+ gpt-pr-config set gh_token MY-GH-TOKEN-VALUE
59
+ ```
60
+
61
+ ### 4. Ready to NEVER WRITE A PR AGAIN
62
+
63
+ 1. Make your changes, commit them, and push to origin (important!).
64
+ 2. Run the following command in your project directory:
65
+
66
+ ```bash
67
+ gpt-pr
68
+ ```
69
+
70
+ 3. Answer the questions. At the end, you'll receive the URL of a freshly opened PR.
71
+
72
+ ## Contributing and Feedback
73
+
74
+ We welcome your contributions and feedback to help improve GPT-PR! Here’s how you can get involved:
75
+
76
+ ### Open Issues
77
+
78
+ - **Feature Requests**: Have an idea for a new feature? We’d love to hear it! Open an issue to request new features or enhancements.
79
+ - **Bug Reports**: Encountered a bug? Let us know by opening an issue with detailed information so we can fix it.
80
+ - **General Feedback**: Any other suggestions or feedback? Feel free to share your thoughts.
81
+
82
+ 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!
83
+
84
+ More details about it at our [CONTRIBUTING](./CONTRIBUTING.md) guide.
85
+
86
+ ## Table of Contents
87
+
88
+ - [Features](#features)
89
+ - [Prerequisites](#prerequisites)
90
+ - [Installation](#installation)
91
+ - [Configuration](#configuration)
92
+ - [Usage](#usage)
93
+ - [How to Contribute](#how-to-contribute)
94
+ - [Roadmap](#roadmap)
95
+
96
+ ## Features
97
+
98
+ - Analyzes the diff changes of the current branch against the `main` branch.
99
+ - Provides an option to exclude certain file changes from PR generation (for instance, you can ignore a `package.lock` file with 5k lines changed).
100
+ - Incorporates commit messages into the process.
101
+
102
+ ## Prerequisites
103
+
104
+ Before getting started, make sure you have the following installed:
105
+
106
+ - Python 3.9 or higher
107
+ - [Poetry](https://python-poetry.org/)
108
+
109
+ ## Installation
110
+
111
+ You can install and use GPT-PR in one of two ways. Choose the option that best suits your needs.
112
+
113
+ ### Option 1: Using `pip install` (Recommended)
114
+
115
+ 1. Install OR Update the package:
116
+
117
+ ```bash
118
+ pip install -U gpt-pr
119
+ ```
120
+
121
+ 2. Setup API keys for GitHub and OpenAI, take a look at [Configuration](#configuration).
122
+
123
+ 3. Inside the Git repository you are working on, ensure you have pushed your branch to origin, then run:
124
+
125
+ ```bash
126
+ gpt-pr --help
127
+ ```
128
+
129
+ ### Option 2: Cloning the code (NOT recommended)
130
+
131
+ 1. Clone the repository:
132
+
133
+ ```bash
134
+ git clone https://github.com/alissonperez/gpt-pr.git
135
+ ```
136
+
137
+ 2. Navigate to the project directory and install dependencies:
138
+
139
+ ```bash
140
+ cd gpt-pr
141
+ poetry install
142
+ ```
143
+
144
+ After setting up API keys ([Configuration](#configuration)), you can use GPT-PR within any git project directory. Suppose you've cloned **this project** to `~/workplace/gpt-pr`, here's how you can use it:
145
+
146
+ ```bash
147
+ poetry run python gpt_pr/main.py --help
148
+ ```
149
+
150
+ ## Configuration
151
+
152
+ ### See all configs available
153
+
154
+ To print all default configs and what is being used, just run:
155
+
156
+ ```bash
157
+ gpt-pr-config print
158
+ ```
159
+
160
+ ### Setting up GitHub Token (`GH_TOKEN`)
161
+
162
+ GPT-PR tool will look for a `GH_TOKEN` in current shell env var OR in gpt-pr config file (at `~/.gpt-pr.ini`).
163
+
164
+ To authenticate with GitHub, generate and export a GitHub Personal Access Token:
165
+
166
+ 1. Navigate to [GitHub's Personal Access Token page](https://github.com/settings/tokens).
167
+ 2. Click "Generate new token."
168
+ 3. Provide a description and select the required permissions `repo` for the token.
169
+ 4. Click "Generate token" at the bottom of the page.
170
+ 5. Copy the generated token.
171
+ 6. Set `gh_token` config running (supposing your gh token is `ghp_4Mb1QEr9gY5e8Lk3tN1KjPzX7W9z2V4HtJ2b`):
172
+
173
+ ```bash
174
+ gpt-pr-config set gh_token ghp_4Mb1QEr9gY5e8Lk3tN1KjPzX7W9z2V4HtJ2b
175
+ ```
176
+
177
+ Or just export it as an environment variable in your shell initializer:
178
+
179
+ ```bash
180
+ export GH_TOKEN=your_generated_token_here
181
+ ```
182
+
183
+ ### Setting up OpenAI API Key (`OPENAI_API_KEY`)
184
+
185
+ GPT-PR tool will look for a `OPENAI_API_KEY` env var in current shell OR in gpt-pr config file (at `~/.gpt-pr.ini`).
186
+
187
+ This project needs to interact with the ChatGPT API to generate the pull request description. So, you need to generate and export an OpenAI API Key:
188
+
189
+ 1. Navigate to [OpenAI's API Key page](https://platform.openai.com/signup).
190
+ 2. If you don't have an account, sign up and log in.
191
+ 3. Go to the API Keys section and click "Create new key."
192
+ 4. Provide a description and click "Create."
193
+ 5. Copy the generated API key.
194
+ 6. Set `openai_api_key` config running (supposing your openai_api_key is `QEr9gY5e8Lk3tN1KjPzX7W9z2V4Ht`):
195
+
196
+ ```bash
197
+ gpt-pr-config set openai_api_key QEr9gY5e8Lk3tN1KjPzX7W9z2V4Ht
198
+ ```
199
+
200
+ Or just export it as an environment variable in your shell initializer:
201
+
202
+ ```bash
203
+ export OPENAI_API_KEY=your_generated_api_key_here
204
+ ```
205
+
206
+ ### Setting Max Input LLM Tokens
207
+
208
+ You can adjust the maximum number of input tokens allowed when calling the LLM model by modifying the corresponding setting.
209
+
210
+ For example, to change the maximum to 20,000 tokens, use the following command:
211
+
212
+ ```bash
213
+ gpt-pr-config set input_max_tokens 20000
214
+ ```
215
+
216
+ ### Change OpenAI model
217
+
218
+ To change OpenAI model, just run:
219
+
220
+ ```bash
221
+ gpt-pr-config set openai_model gpt-4o-mini
222
+ ```
223
+
224
+ > Obs.: `gpt-4o-mini` already is the default model of the project
225
+
226
+ To see a full list of available models, access [OpenAI Models Documentation](https://platform.openai.com/docs/models)
227
+
228
+ ### GPT-PR Library Signature in PRs
229
+
230
+ 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.
231
+
232
+ If you prefer to disable this feature, simply run the following command:
233
+
234
+ ```bash
235
+ gpt-pr-config set add_tool_signature false
236
+ ```
237
+
238
+ ### Reset config
239
+
240
+ To reset any config to default value, just run:
241
+
242
+ ```bash
243
+ gpt-pr-config reset config_name
244
+ ```
245
+
246
+ Example:
247
+
248
+ ```bash
249
+ gpt-pr-config reset openai_model
250
+ ```
251
+
252
+ ## Usage
253
+
254
+ ### Generating Github Pull Requests
255
+
256
+ To create a Pull request from your current branch commits to merge with `main` branch, just run:
257
+
258
+ ```
259
+ gpt-pr
260
+ ```
261
+
262
+ If you would like to compare with other base branch that is not `main`, just use `-b` param:
263
+
264
+ ```
265
+ gpt-pr -b my-other-branch
266
+ ```
267
+
268
+ ### Usage help
269
+
270
+ To show help commands:
271
+
272
+ ```
273
+ gpt-pr -h
274
+ ```
275
+
276
+ Output:
277
+ ![image](https://github.com/alissonperez/gpt-pr/assets/756802/cc6c0ca4-5759-44ce-ad35-e4e7305b3875)
278
+
279
+ ## Roadmap
280
+
281
+ - [x] Improve execution method, possibly through a shell script or at least an alias in bash rc files.
282
+ - Change to use with pip installation and console_scripts entry point.
283
+ - [x] Fetch GitHub PR templates from the current project.
284
+ - [ ] Add configuration to set which LLM and model should be used (OpenAI GPT, Mistral, etc...)
285
+ - [ ] Add unit tests.
286
+
@@ -0,0 +1,17 @@
1
+ gpt_pr/__init__.py,sha256=Bs14snCQfkRZPxYfLq-haC5mArtZpKcML3Sa9y9LRYs,72
2
+ gpt_pr/checkversion.py,sha256=fY1lLlFDEKY9EFHgMNkxZjPA0WmY2czydIaaIvgt7uc,2428
3
+ gpt_pr/config.py,sha256=jOr95rErnk-MByWtC92bpgY2dyVc6bbrjaVoP61oO-s,2822
4
+ gpt_pr/consolecolor.py,sha256=_JmBMNjIflWMlgP2VkCWu6uQLR9oHBy52uV3TRJJgF4,800
5
+ gpt_pr/gh.py,sha256=JwFRFjwYqO3O3equVJs1FAFTFpG__qEhSkr_-2C3GrI,1238
6
+ gpt_pr/gitutil.py,sha256=yqvpw_pq7Bw_uOcNa4eaUVIFu6YhrK6cjd-74Obtqfk,5996
7
+ gpt_pr/gpt.py,sha256=CSAX9Z6FQOLXOzbLMe_Opqtc3ruDAKTTk7cPqc6Blh0,263
8
+ gpt_pr/main.py,sha256=zl6qeIoKPX-zT-Mt9sGbCQusz5ejoLAdiKLV4MCFpWA,2850
9
+ gpt_pr/prdata.py,sha256=aWPf0cdsdF2EVSEjFqHqZrq1GzPkEPc6jrySiLt6iuU,7583
10
+ gpt_pr/test_checkversion.py,sha256=slw1Tn4H_2QPrKSQfupi5LMIJsDa1fnSU1v5grGX3Ow,4227
11
+ gpt_pr/test_config.py,sha256=J5CSEj8JbKw_57E0IQit5LgmrsCmboe9li2esT2F5pg,3577
12
+ gpt_pr/test_gh.py,sha256=WfZ0GC4C04hk0g0raIDEPODD74AUJcY4BNT3wAYStcQ,1772
13
+ gpt_pr/test_prdata.py,sha256=TF7FZ_PW-NPj3YvC7ICz5NSVQ98JRVWX1lyHfQv3Eow,499
14
+ gpt_pr-0.7.1.dist-info/METADATA,sha256=k8WML4miusXDgbjhfWuqcwfKo9tY081XGpCWJj3dA2M,9082
15
+ gpt_pr-0.7.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
16
+ gpt_pr-0.7.1.dist-info/entry_points.txt,sha256=EJAujhCl6OFb9AmBGWRXd5VamvyCObYVtByaGU-sLs4,80
17
+ gpt_pr-0.7.1.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ gpt-pr=gpt_pr.main:main
3
+ gpt-pr-config=gpt_pr.main:run_config
4
+
@@ -1,49 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: gpt-pr
3
- Version: 0.7.0
4
- Summary: Automate your GitHub workflow with GPT-PR: an OpenAI powered library for streamlined PR generation.
5
- Home-page: http://github.com/alissonperez/gpt-pr
6
- Author: Alisson R. Perez
7
- Author-email: alissonperez@outlook.com
8
- License: MIT
9
- Requires-Python: >=3.7
10
- Requires-Dist: cffi ==1.15.1
11
- Requires-Dist: cryptography ==43.0.3
12
- Requires-Dist: fire ==0.6.0
13
- Requires-Dist: pycparser ==2.21
14
- Requires-Dist: wcwidth ==0.2.13
15
- Requires-Dist: charset-normalizer ==3.4.0 ; python_full_version >= "3.7.0"
16
- Requires-Dist: prompt-toolkit ==3.0.43 ; python_full_version >= "3.7.0"
17
- Requires-Dist: openai ==1.14.0 ; python_full_version >= "3.7.1"
18
- Requires-Dist: exceptiongroup ==1.2.2 ; python_version < "3.11"
19
- Requires-Dist: cached-property ==1.5.2 ; python_version < "3.8"
20
- Requires-Dist: importlib-metadata ==6.7.0 ; python_version == "3.7"
21
- Requires-Dist: six ==1.16.0 ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2"
22
- Requires-Dist: deprecated ==1.2.14 ; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
23
- Requires-Dist: certifi ==2024.8.30 ; python_version >= "3.6"
24
- Requires-Dist: distro ==1.9.0 ; python_version >= "3.6"
25
- Requires-Dist: idna ==3.10 ; python_version >= "3.6"
26
- Requires-Dist: pynacl ==1.5.0 ; python_version >= "3.6"
27
- Requires-Dist: wrapt ==1.16.0 ; python_version >= "3.6"
28
- Requires-Dist: annotated-types ==0.5.0 ; python_version >= "3.7"
29
- Requires-Dist: anyio ==3.7.1 ; python_version >= "3.7"
30
- Requires-Dist: gitdb ==4.0.11 ; python_version >= "3.7"
31
- Requires-Dist: gitpython ==3.1.42 ; python_version >= "3.7"
32
- Requires-Dist: h11 ==0.14.0 ; python_version >= "3.7"
33
- Requires-Dist: httpcore ==0.17.3 ; python_version >= "3.7"
34
- Requires-Dist: httpx ==0.24.1 ; python_version >= "3.7"
35
- Requires-Dist: pydantic ==2.5.3 ; python_version >= "3.7"
36
- Requires-Dist: pydantic-core ==2.14.6 ; python_version >= "3.7"
37
- Requires-Dist: pygithub ==2.2.0 ; python_version >= "3.7"
38
- Requires-Dist: pyjwt[crypto] ==2.8.0 ; python_version >= "3.7"
39
- Requires-Dist: requests ==2.31.0 ; python_version >= "3.7"
40
- Requires-Dist: smmap ==5.0.1 ; python_version >= "3.7"
41
- Requires-Dist: sniffio ==1.3.1 ; python_version >= "3.7"
42
- Requires-Dist: termcolor ==2.3.0 ; python_version >= "3.7"
43
- Requires-Dist: tqdm ==4.67.0 ; python_version >= "3.7"
44
- Requires-Dist: typing-extensions ==4.7.1 ; python_version >= "3.7"
45
- Requires-Dist: urllib3 ==2.0.7 ; python_version >= "3.7"
46
- Requires-Dist: zipp ==3.15.0 ; python_version >= "3.7"
47
- Requires-Dist: inquirerpy ==0.3.4 ; python_version >= "3.7" and python_version < "4.0"
48
- Requires-Dist: pfzy ==0.3.4 ; python_version >= "3.7" and python_version < "4.0"
49
-
@@ -1,17 +0,0 @@
1
- gptpr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- gptpr/checkversion.py,sha256=PmbGiYJelecs1Fv2aAZwdr6wn-qDC826nsYI4A6LLvk,2389
3
- gptpr/config.py,sha256=jOr95rErnk-MByWtC92bpgY2dyVc6bbrjaVoP61oO-s,2822
4
- gptpr/consolecolor.py,sha256=_JmBMNjIflWMlgP2VkCWu6uQLR9oHBy52uV3TRJJgF4,800
5
- gptpr/gh.py,sha256=E03xg8UHfZlHJAY-aAYphpgS3xl-FZ2dmI5oBC2XdoA,1136
6
- gptpr/gitutil.py,sha256=yqvpw_pq7Bw_uOcNa4eaUVIFu6YhrK6cjd-74Obtqfk,5996
7
- gptpr/main.py,sha256=Is8CMg6lCNKiAFZ4OWUZk9gv8uk-JtqxBKviKoVmYXw,2719
8
- gptpr/prdata.py,sha256=Uls18CtkxWlflfHKrB62hT21MTUVabf8JgJ6CxOOccQ,7053
9
- gptpr/test_checkversion.py,sha256=WtJ3v4MMkFG0Kob0R1wi_nwVhcQFd4mXtKCKZHajEhM,4266
10
- gptpr/test_config.py,sha256=iL3b-Ypv1TaMQTFb6mrDKw8fPio3WBpMcaFkWbiLdNQ,3369
11
- gptpr/test_prdata.py,sha256=rSJ-yqOdw-iYdBWyqnA2SXbdrhT8KgIkRTTf9SY1S1g,474
12
- gptpr/version.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
13
- gpt_pr-0.7.0.dist-info/METADATA,sha256=BgN9xwsERgW0Z4GLToiWkBmUXAxlVnFwdfWu0n8-6I8,2640
14
- gpt_pr-0.7.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
15
- gpt_pr-0.7.0.dist-info/entry_points.txt,sha256=WhcbcQXqo5-IGliYWiYMhop4-Wm7bcH2ljFKLWrmO7c,81
16
- gpt_pr-0.7.0.dist-info/top_level.txt,sha256=DZcbzlsjh4BD8njGcvhOeCZ83U_oYWgCn0w8qx5--04,6
17
- gpt_pr-0.7.0.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- gpt-pr = gptpr.main:main
3
- gpt-pr-config = gptpr.main:run_config
@@ -1 +0,0 @@
1
- gptpr
gptpr/__init__.py DELETED
File without changes
gptpr/gh.py DELETED
@@ -1,37 +0,0 @@
1
- import os
2
- from github import Github
3
- from InquirerPy import inquirer
4
- from gptpr.config import config, config_command_example, CONFIG_README_SECTION
5
-
6
-
7
- def _get_gh_token():
8
- gh_token = config.get_user_config('GH_TOKEN')
9
- if not gh_token:
10
- gh_token = os.environ.get('GH_TOKEN')
11
-
12
- if not gh_token:
13
- print('Please set "gh_token" config. Just run:',
14
- config_command_example('gh_token', '[my gh token]'),
15
- 'more about at', CONFIG_README_SECTION)
16
- exit(1)
17
-
18
- return gh_token
19
-
20
-
21
- gh = Github(_get_gh_token())
22
-
23
-
24
- def create_pr(pr_data, yield_confirmation):
25
- repo = gh.get_repo(
26
- f'{pr_data.branch_info.owner}/{pr_data.branch_info.repo}')
27
-
28
- pr_confirmation = yield_confirmation or inquirer.confirm(
29
- message="Create GitHub PR?",
30
- default=True).execute()
31
-
32
- if pr_confirmation:
33
- pr = repo.create_pull(title=pr_data.title, body=pr_data.create_body(),
34
- head=pr_data.branch_info.branch, base=pr_data.branch_info.base_branch)
35
- print("Pull request created successfully: ", pr.html_url)
36
- else:
37
- print('cancelling...')