gpt-pr 0.5.0__tar.gz → 0.6.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.5.0
3
+ Version: 0.6.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
@@ -126,6 +126,16 @@ Or just export it as an environment variable in your shell initializer:
126
126
  export OPENAI_API_KEY=your_generated_api_key_here
127
127
  ```
128
128
 
129
+ ### Setting Max Input LLM Tokens
130
+
131
+ You can adjust the maximum number of input tokens allowed when calling the LLM model by modifying the corresponding setting.
132
+
133
+ For example, to change the maximum to 20,000 tokens, use the following command:
134
+
135
+ ```bash
136
+ gpt-pr-config set input_max_tokens 20000
137
+ ```
138
+
129
139
  ### Change OpenAI model
130
140
 
131
141
  To change OpenAI model, just run:
@@ -138,12 +148,22 @@ gpt-pr-config set openai_model gpt-4o-mini
138
148
 
139
149
  To see a full list of available models, access [OpenAI Models Documentation](https://platform.openai.com/docs/models)
140
150
 
151
+ ### GPT-PR Library Signature in PRs
152
+
153
+ 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.
154
+
155
+ If you prefer to disable this feature, simply run the following command:
156
+
157
+ ```bash
158
+ gpt-pr-config set add_tool_signature false
159
+ ```
160
+
141
161
  ### Reset config
142
162
 
143
163
  To reset any config to default value, just run:
144
164
 
145
165
  ```bash
146
- gpt-pr-config reset config-name
166
+ gpt-pr-config reset config_name
147
167
  ```
148
168
 
149
169
  Example:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.5.0
3
+ Version: 0.6.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
@@ -7,7 +7,8 @@ def config_command_example(name, value_sample):
7
7
  return f'gpt-pr-config set {name} {value_sample}'
8
8
 
9
9
 
10
- CONFIG_README_SECTION = 'https://github.com/alissonperez/gpt-pr?tab=readme-ov-file#configuration'
10
+ CONFIG_PROJECT_REPO_URL = 'https://github.com/alissonperez/gpt-pr'
11
+ CONFIG_README_SECTION = f'{CONFIG_PROJECT_REPO_URL}?tab=readme-ov-file#configuration'
11
12
 
12
13
 
13
14
  class Config:
@@ -15,6 +16,9 @@ class Config:
15
16
  config_filename = '.gpt-pr.ini'
16
17
 
17
18
  _default_config = {
19
+ # Amenities
20
+ 'ADD_TOOL_SIGNATURE': 'true', # Add GPT-PR signature to PRs
21
+
18
22
  # Github
19
23
  'GH_TOKEN': '',
20
24
 
@@ -30,7 +30,7 @@ def create_pr(pr_data, yield_confirmation):
30
30
  default=True).execute()
31
31
 
32
32
  if pr_confirmation:
33
- pr = repo.create_pull(title=pr_data.title, body=pr_data.body,
33
+ pr = repo.create_pull(title=pr_data.title, body=pr_data.create_body(),
34
34
  head=pr_data.branch_info.branch, base=pr_data.branch_info.base_branch)
35
35
  print("Pull request created successfully: ", pr.html_url)
36
36
  else:
@@ -4,7 +4,7 @@ import os
4
4
  from openai import OpenAI
5
5
 
6
6
  from gptpr.gitutil import BranchInfo
7
- from gptpr.config import config
7
+ from gptpr.config import config, CONFIG_PROJECT_REPO_URL
8
8
  import gptpr.consolecolor as cc
9
9
 
10
10
  TOKENIZER_RATIO = 4
@@ -67,9 +67,18 @@ class PrData():
67
67
  f'{cc.bold("Title")}: {cc.yellow(self.title)}',
68
68
  f'{cc.bold("Branch name")}: {cc.yellow(self.branch_info.branch)}',
69
69
  f'{cc.bold("Base branch")}: {cc.yellow(self.branch_info.base_branch)}',
70
- f'{cc.bold("PR Description")}:\n{self.body}',
70
+ f'{cc.bold("PR Description")}:\n{self.create_body()}',
71
71
  ])
72
72
 
73
+ def create_body(self):
74
+ body = self.body
75
+
76
+ if config.get_user_config('ADD_TOOL_SIGNATURE') == 'true':
77
+ pr_signature = f'Generated by [GPT-PR]({CONFIG_PROJECT_REPO_URL})'
78
+ body += '\n\n---\n\n' + pr_signature
79
+
80
+ return body
81
+
73
82
 
74
83
  functions = [
75
84
  {
@@ -87,10 +87,12 @@ def test_all_values(temp_config):
87
87
  all_values = config.all_values()
88
88
 
89
89
  assert all_values == [
90
+ ('DEFAULT', 'add_tool_signature', 'true'),
90
91
  ('DEFAULT', 'gh_token', ''),
91
92
  ('DEFAULT', 'input_max_tokens', '15000'),
92
93
  ('DEFAULT', 'openai_model', 'gpt-4o-mini'),
93
94
  ('DEFAULT', 'openai_api_key', ''),
95
+ ('user', 'add_tool_signature', 'true'),
94
96
  ('user', 'gh_token', ''),
95
97
  ('user', 'input_max_tokens', '15000'),
96
98
  ('user', 'openai_model', 'gpt-4o-mini'),
@@ -0,0 +1 @@
1
+ __version__ = "0.6.0"
@@ -1 +0,0 @@
1
- __version__ = "0.5.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