File tree Expand file tree Collapse file tree 6 files changed +13
-29
lines changed Expand file tree Collapse file tree 6 files changed +13
-29
lines changed Original file line number Diff line number Diff line change @@ -49,20 +49,18 @@ That's it! GHPush will:
49
49
50
50
## ⚙️ Configuration
51
51
52
- ### OpenAI Integration (Optional)
52
+ ### OpenAI Integration (Required)
53
+
54
+ Set your OpenAI API key as an environment variable:
53
55
54
- 1 . Create your configuration:
55
56
``` bash
56
- cp .env.example .env
57
- ```
57
+ # Linux/macOS
58
+ export OPENAI_API_KEY=your-api-key-here
58
59
59
- 2 . Add your OpenAI API key:
60
- ``` env
61
- OPENAI_API_KEY=your_openai_api_key_here
60
+ # Windows (PowerShell)
61
+ $env :OPENAI_API_KEY=" your-api-key-here"
62
62
```
63
63
64
- > 💡 ** Note:** GHPush works perfectly fine without AI integration, falling back to basic summarization.
65
-
66
64
## 🛠 Technical Requirements
67
65
68
66
- Python ≥ 3.8.1
Original file line number Diff line number Diff line change 1
1
"""GHPush - Automated GitHub PR creation tool."""
2
2
3
- __version__ = "0.1.2 "
3
+ __version__ = "0.1.5 "
Original file line number Diff line number Diff line change 2
2
import json
3
3
import os
4
4
from pathlib import Path
5
- from dotenv import load_dotenv
6
5
7
6
class Config :
8
7
def __init__ (self ):
9
8
self .config_dir = Path .home () / ".ghpush"
10
9
self .config_file = self .config_dir / "config.json"
11
10
self ._ensure_config_dir ()
12
11
self .config = self ._load_config ()
13
-
14
- # Load environment variables
15
- load_dotenv ()
16
12
17
13
def _ensure_config_dir (self ):
18
14
"""Ensure configuration directory exists."""
@@ -40,12 +36,5 @@ def get_github_token(self) -> str:
40
36
return os .getenv ('GITHUB_TOKEN' ) or self .config .get ('github_token' )
41
37
42
38
def get_openai_api_key ():
43
- # First check environment variable
44
- api_key = os .getenv ('OPENAI_API_KEY' )
45
-
46
- # If not found in environment, try loading from .env
47
- if not api_key :
48
- load_dotenv (silent = True ) # silent=True prevents errors if .env doesn't exist
49
- api_key = os .getenv ('OPENAI_API_KEY' )
50
-
51
- return api_key
39
+ """Get OpenAI API key from environment."""
40
+ return os .getenv ('OPENAI_API_KEY' )
Original file line number Diff line number Diff line change 2
2
import os
3
3
import subprocess
4
4
from rich .console import Console
5
+ from .config import get_openai_api_key
5
6
6
7
console = Console ()
7
8
@@ -11,9 +12,7 @@ def validate_openai_key():
11
12
if not api_key :
12
13
raise ValueError (
13
14
"OpenAI API key not found.\n \n "
14
- "To fix this, either:\n "
15
- "1. Set the OPENAI_API_KEY environment variable, or\n "
16
- "2. Create a .env file with your API key"
15
+ "To fix this, set the OPENAI_API_KEY environment variable"
17
16
)
18
17
return api_key
19
18
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " ghpush"
3
- version = " 0.1.2 "
3
+ version = " 0.1.5 "
4
4
5
5
description = " AI-powered GitHub PR creation tool that automatically generates PR titles and descriptions"
6
6
authors = [
" Your Name <[email protected] >" ]
@@ -29,7 +29,6 @@ click = "^8.1.3"
29
29
gitpython = " ^3.1.31"
30
30
rich = " ^13.3.5"
31
31
openai = " ^1.3.0"
32
- python-dotenv = " ^1.0.0"
33
32
34
33
[tool .poetry .group .dev .dependencies ]
35
34
pytest = " ^7.3.1"
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ def get_version():
15
15
"gitpython" ,
16
16
"rich" ,
17
17
"openai" ,
18
- "python-dotenv" ,
19
18
],
20
19
entry_points = {
21
20
"console_scripts" : [
You can’t perform that action at this time.
0 commit comments