Skip to content

Commit 279d00e

Browse files
committed
Moved the .env.example to the root folder. Also made sure the API keys are being loaded from .env in the root folder
1 parent 0232247 commit 279d00e

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed
File renamed without changes.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Built for Engineers, Product Managers, and Team Leads to speed up Sprint Plannin
4747

4848
`$ cd sprintcore`
4949

50-
`$ cp sprintcore/example/.env.example .env`
50+
`$ cp .env.example .env`
5151

52-
`$ pip install sprintcore`
52+
`$ pip install --no-cache-dir --upgrade --force-reinstall sprintcore`
5353

5454

5555

sprintcore/main.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,26 @@
99

1010
def main():
1111
env_path = find_dotenv()
12-
load_dotenv(dotenv_path=env_path, override=True)
1312

14-
for var in ["OPENAI_API_KEY", "ANTHROPIC_API_KEY"]:
15-
val = os.getenv(var)
13+
load_dotenv(dotenv_path='.env', override=True)
14+
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
15+
ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY')
16+
print(f"OPENAI_API_KEY={OPENAI_API_KEY} ANTHROPIC_API_KEY={ANTHROPIC_API_KEY}")
17+
required_keys = ["OPENAI_API_KEY", "ANTHROPIC_API_KEY"]
18+
missing_key = 0
19+
for key in required_keys:
20+
if not os.getenv(key):
21+
missing_key = 1
22+
print(f"❌ {key} is missing")
23+
else:
24+
print(f"✅ {key} is loaded")
25+
26+
if (missing_key == 1):
27+
print("❌ One or more API keys are missing!")
28+
print("You can copy .env.example to .env. API keys should be set in .env")
29+
sys.exit(1)
30+
1631

17-
from_env = env_path and var in open(os.path.expanduser(env_path)).read()
18-
source = ".env" if from_env else "shell"
19-
if not from_env:
20-
print(f"❌ {var} must be set in the .env file, but was loaded from the shell.")
21-
sys.exit(1)
2232

2333
parser = argparse.ArgumentParser(prog='sprintcore', description='SprintCore CLI - AI-powered sprint planning')
2434
subparsers = parser.add_subparsers(dest='command', required=True)

0 commit comments

Comments
 (0)