-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
58 lines (48 loc) · 1.68 KB
/
Copy pathsetup.py
File metadata and controls
58 lines (48 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import subprocess
import sys
from pathlib import Path
def setup_environment():
"""Setup the project environment"""
print("Setting up project environment...")
# Create virtual environment if it doesn't exist
if not os.path.exists('venv'):
print("Creating virtual environment...")
subprocess.run([sys.executable, '-m', 'venv', 'venv'])
# Activate virtual environment
if os.name == 'nt': # Windows
activate_script = os.path.join('venv', 'Scripts', 'activate')
else: # Unix/Linux
activate_script = os.path.join('venv', 'bin', 'activate')
# Install/upgrade pip
print("Upgrading pip...")
subprocess.run([
os.path.join('venv', 'bin', 'python'),
'-m', 'pip', 'install', '--upgrade', 'pip'
])
# Install requirements
print("Installing requirements...")
subprocess.run([
os.path.join('venv', 'bin', 'pip'),
'install', '-r', 'requirements.txt'
])
# Create necessary directories
dirs = ['logs', 'data', 'config', 'temp']
for dir_name in dirs:
Path(dir_name).mkdir(exist_ok=True)
# Create .env file if it doesn't exist
if not os.path.exists('.env'):
print("Creating .env file template...")
with open('.env', 'w') as f:
f.write("""# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Asana Configuration
ASANA_ACCESS_TOKEN=your_asana_access_token_here
ASANA_WORKSPACE_GID=your_workspace_gid_here
# Other Configuration
LOG_LEVEL=INFO
ENVIRONMENT=development
""")
print("Please update the .env file with your API keys and configuration.")
if __name__ == "__main__":
setup_environment()