gpt-pr 0.0.2__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.

@@ -0,0 +1,3 @@
1
+ include requirements.txt
2
+
3
+ global-exclude *~ *.py[cod] *.so
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.0.2
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
@@ -4,6 +4,15 @@ 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
+ ## Table of Contents
8
+
9
+ - [Features](#features)
10
+ - [Prerequisites](#prerequisites)
11
+ - [Installation and Usage](#installation-and-usage)
12
+ - [Authentication & API Keys](#authentication--api-keys)
13
+ - [How to Contribute](#how-to-contribute)
14
+ - [Roadmap](#roadmap)
15
+
7
16
  ## Features
8
17
 
9
18
  - Analyzes the diff changes of the current branch against the `main` branch.
@@ -17,21 +26,50 @@ Before getting started, make sure you have the following installed:
17
26
  - Python 3.7 or higher
18
27
  - [Pipenv](https://pipenv.pypa.io/en/latest/)
19
28
 
20
- ## Installation
29
+ ## Installation and usage
30
+
31
+ You can install and use GPT-PR in one of two ways. Choose the option that best suits your needs.
32
+
33
+ ### Option 1: Using `pip install` (Recommended)
34
+
35
+ 1. Install the package:
36
+
37
+ ```bash
38
+ pip install -U gpt-pr
39
+ ```
40
+
41
+ > Note: Use this command to **update** gpt-pr package to the latest version.
42
+
43
+ 2. Export API keys as environment variables ([Authentication & API Keys](#authentication--api-keys)).
44
+
45
+ 3. Inside the Git repository you are working on, ensure you have pushed your branch to origin, then run:
46
+
47
+ ```bash
48
+ gpt-pr
49
+ ```
50
+
51
+ ### Option 2: Cloning the code
52
+
21
53
 
22
54
  1. Clone the repository:
23
55
 
24
56
  ```bash
25
57
  git clone https://github.com/alissonperez/gpt-pr.git
26
- cd gpt-pr
27
58
  ```
28
59
 
29
- 2. Install the dependencies with Pipenv:
60
+ 2. Navigate to the project directory and install dependencies:
30
61
 
31
62
  ```bash
63
+ cd gpt-pr
32
64
  pipenv install
33
65
  ```
34
66
 
67
+ After exporting api keys as environment variables ([Authentication & API Keys](#authentication--api-keys)), 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:
68
+
69
+ ```bash
70
+ PIPENV_PIPFILE=~/workplace/gpt-pr/Pipfile pipenv run python ~/workplace/gpt-pr/main.py
71
+ ```
72
+
35
73
  ## Authentication & API Keys
36
74
 
37
75
  ### Setting up GitHub Token (`GH_TOKEN`)
@@ -64,23 +102,16 @@ This project needs to interact with the ChatGPT API to generate the pull request
64
102
  export OPENAI_API_KEY=your_generated_api_key_here
65
103
  ```
66
104
 
67
- ## Usage
68
-
69
- After exporting api keys as environment variables ([Authentication & API Keys](#authentication--api-keys)), 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:
70
-
71
- ```bash
72
- PIPENV_PIPFILE=~/workplace/gpt-pr/Pipfile pipenv run python ~/workplace/gpt-pr/main.py
73
- ```
74
-
75
105
  Output:
76
106
  ![image](https://github.com/alissonperez/gpt-pr/assets/756802/cc6c0ca4-5759-44ce-ad35-e4e7305b3875)
77
107
 
78
108
  ## How to contribute?
79
109
 
80
- Follow our [CONTRIBUTING](./CONTRIBUTING.md) guide.
110
+ Please follow our [CONTRIBUTING](./CONTRIBUTING.md) guide.
81
111
 
82
112
  ## Roadmap
83
113
 
84
- - [ ] Improve execution method, possibly through a shell script or at least an alias in bash rc files.
114
+ - [x] Improve execution method, possibly through a shell script or at least an alias in bash rc files.
115
+ - Change to use with pip installation and console_scripts entry point.
85
116
  - [ ] Add unit tests.
86
117
  - [ ] Fetch GitHub PR templates from the current project.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpt-pr
3
- Version: 0.0.2
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
@@ -11,6 +11,7 @@ gpt_pr.egg-info/not-zip-safe
11
11
  gpt_pr.egg-info/requires.txt
12
12
  gpt_pr.egg-info/top_level.txt
13
13
  gptpr/__init__.py
14
+ gptpr/__version__.py
14
15
  gptpr/consolecolor.py
15
16
  gptpr/gh.py
16
17
  gptpr/gitutil.py
@@ -1,28 +1,19 @@
1
1
  cffi==1.15.1
2
2
  cryptography==41.0.3
3
- gitpython==3.1.32
4
- inquirerpy==0.3.4
5
- openai==0.27.8
6
- prompt-toolkit==3.0.39
7
3
  pycparser==2.21
8
- pygithub==1.59.1
9
4
  wcwidth==0.2.6
10
5
 
11
6
  [:python_full_version >= "3.7.0"]
12
- aiosignal==1.3.1
13
- async-timeout==4.0.3
14
- attrs==23.1.0
15
7
  charset-normalizer==3.2.0
16
- gitdb==4.0.10
17
- multidict==6.0.4
18
- pyjwt[crypto]==2.8.0
19
- requests==2.31.0
20
- tqdm==4.66.1
21
- urllib3==2.0.4
22
- yarl==1.9.2
8
+ prompt-toolkit==3.0.39
23
9
 
24
- [:python_version < "4.0" and python_full_version >= "3.7.0"]
25
- pfzy==0.3.4
10
+ [:python_full_version >= "3.7.1"]
11
+ openai==0.28.0
12
+
13
+ [:python_version < "3.8"]
14
+ asynctest==0.13.0
15
+ importlib-metadata==6.7.0
16
+ typing-extensions==4.7.1
26
17
 
27
18
  [:python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"]
28
19
  deprecated==1.2.14
@@ -39,5 +30,22 @@ certifi==2023.7.22
39
30
  pynacl==1.5.0
40
31
  smmap==5.0.0
41
32
 
42
- [:python_version >= "3.8"]
43
- frozenlist==1.4.0
33
+ [:python_version >= "3.7"]
34
+ aiosignal==1.3.1
35
+ async-timeout==4.0.3
36
+ attrs==23.1.0
37
+ frozenlist==1.3.3
38
+ gitdb==4.0.10
39
+ gitpython==3.1.35
40
+ multidict==6.0.4
41
+ pygithub==1.59.1
42
+ pyjwt[crypto]==2.8.0
43
+ requests==2.31.0
44
+ tqdm==4.66.1
45
+ urllib3==2.0.4
46
+ yarl==1.9.2
47
+ zipp==3.15.0
48
+
49
+ [:python_version >= "3.7" and python_version < "4.0"]
50
+ inquirerpy==0.3.4
51
+ pfzy==0.3.4
@@ -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
 
@@ -0,0 +1,34 @@
1
+ -i https://pypi.org/simple
2
+ aiohttp==3.8.5; python_version >= '3.6'
3
+ aiosignal==1.3.1; python_version >= '3.7'
4
+ async-timeout==4.0.3; python_version >= '3.7'
5
+ asynctest==0.13.0; python_version < '3.8'
6
+ attrs==23.1.0; python_version >= '3.7'
7
+ certifi==2023.7.22; python_version >= '3.6'
8
+ cffi==1.15.1
9
+ charset-normalizer==3.2.0; python_full_version >= '3.7.0'
10
+ cryptography==41.0.3
11
+ deprecated==1.2.14; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
12
+ frozenlist==1.3.3; python_version >= '3.7'
13
+ gitdb==4.0.10; python_version >= '3.7'
14
+ gitpython==3.1.35; python_version >= '3.7'
15
+ idna==3.4; python_version >= '3.5'
16
+ importlib-metadata==6.7.0; python_version < '3.8'
17
+ inquirerpy==0.3.4; python_version >= '3.7' and python_version < '4.0'
18
+ multidict==6.0.4; python_version >= '3.7'
19
+ openai==0.28.0; python_full_version >= '3.7.1'
20
+ pfzy==0.3.4; python_version >= '3.7' and python_version < '4.0'
21
+ prompt-toolkit==3.0.39; python_full_version >= '3.7.0'
22
+ pycparser==2.21
23
+ pygithub==1.59.1; python_version >= '3.7'
24
+ pyjwt[crypto]==2.8.0; python_version >= '3.7'
25
+ pynacl==1.5.0; python_version >= '3.6'
26
+ requests==2.31.0; python_version >= '3.7'
27
+ smmap==5.0.0; python_version >= '3.6'
28
+ tqdm==4.66.1; python_version >= '3.7'
29
+ typing-extensions==4.7.1; python_version < '3.8'
30
+ urllib3==2.0.4; python_version >= '3.7'
31
+ wcwidth==0.2.6
32
+ wrapt==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
33
+ yarl==1.9.2; python_version >= '3.7'
34
+ zipp==3.15.0; python_version >= '3.7'
@@ -1,4 +1,3 @@
1
- import subprocess
2
1
  from setuptools import setup, find_packages
3
2
 
4
3
 
@@ -9,18 +8,6 @@ def dependencies_filter(dependency):
9
8
  return True
10
9
 
11
10
 
12
- def get_pipenv_requirements():
13
- result = subprocess.run(['pipenv', 'requirements'], capture_output=True, text=True)
14
-
15
- if result.returncode == 0:
16
- dependencies = [dependency
17
- for dependency in result.stdout.splitlines()
18
- if dependencies_filter(dependency)]
19
- return dependencies
20
- else:
21
- raise RuntimeError(f"'pipenv requirements' failed with error: {result.stderr}")
22
-
23
-
24
11
  def get_requirements():
25
12
  with open('requirements.txt') as f:
26
13
  dependencies = [dependency
@@ -29,10 +16,20 @@ def get_requirements():
29
16
  return dependencies
30
17
 
31
18
 
19
+ version = None
20
+ if not version:
21
+ version_package_data = {}
22
+ with open('./gptpr/__version__.py') as f:
23
+ exec(f.read(), version_package_data)
24
+
25
+ version = version_package_data['__version__']
26
+
27
+
32
28
  setup(name='gpt-pr',
33
- version='0.0.2',
29
+ version=version,
34
30
  python_requires='>=3.7',
35
- description='Automate your GitHub workflow with GPT-PR: an OpenAI powered library for streamlined PR generation.',
31
+ description=('Automate your GitHub workflow with GPT-PR: '
32
+ 'an OpenAI powered library for streamlined PR generation.'),
36
33
  url='http://github.com/alissonperez/gpt-pr',
37
34
  author='Alisson R. Perez',
38
35
  author_email='alissonperez@outlook.com',
gpt-pr-0.0.2/MANIFEST.in DELETED
@@ -1 +0,0 @@
1
- include requirements.txt
@@ -1,30 +0,0 @@
1
- -i https://pypi.org/simple
2
- aiohttp==3.8.5; python_version >= '3.6'
3
- aiosignal==1.3.1; python_full_version >= '3.7.0'
4
- async-timeout==4.0.3; python_full_version >= '3.7.0'
5
- attrs==23.1.0; python_full_version >= '3.7.0'
6
- certifi==2023.7.22; python_version >= '3.6'
7
- cffi==1.15.1
8
- charset-normalizer==3.2.0; python_full_version >= '3.7.0'
9
- cryptography==41.0.3
10
- deprecated==1.2.14; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
11
- frozenlist==1.4.0; python_version >= '3.8'
12
- gitdb==4.0.10; python_full_version >= '3.7.0'
13
- gitpython==3.1.32
14
- idna==3.4; python_version >= '3.5'
15
- inquirerpy==0.3.4
16
- multidict==6.0.4; python_full_version >= '3.7.0'
17
- openai==0.27.8
18
- pfzy==0.3.4; python_version < '4.0' and python_full_version >= '3.7.0'
19
- prompt-toolkit==3.0.39
20
- pycparser==2.21
21
- pygithub==1.59.1
22
- pyjwt[crypto]==2.8.0; python_full_version >= '3.7.0'
23
- pynacl==1.5.0; python_version >= '3.6'
24
- requests==2.31.0; python_full_version >= '3.7.0'
25
- smmap==5.0.0; python_version >= '3.6'
26
- tqdm==4.66.1; python_full_version >= '3.7.0'
27
- urllib3==2.0.4; python_full_version >= '3.7.0'
28
- wcwidth==0.2.6
29
- wrapt==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
30
- yarl==1.9.2; python_full_version >= '3.7.0'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes