-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
166 lines (145 loc) · 5.29 KB
/
setup.py
File metadata and controls
166 lines (145 loc) · 5.29 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/env python3
"""
10x-Outreach-Skill Setup Script
Initializes the environment and installs dependencies
"""
import os
import sys
import subprocess
import shutil
from pathlib import Path
# Colors for terminal output
class Colors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BLUE = '\033[94m'
RESET = '\033[0m'
BOLD = '\033[1m'
def print_status(msg, status="info"):
icons = {
"info": f"{Colors.BLUE}[i]{Colors.RESET}",
"success": f"{Colors.GREEN}[OK]{Colors.RESET}",
"warning": f"{Colors.YELLOW}[!]{Colors.RESET}",
"error": f"{Colors.RED}[X]{Colors.RESET}",
}
print(f"{icons.get(status, icons['info'])} {msg}")
def main():
print(f"\n{Colors.BOLD}{'='*60}{Colors.RESET}")
print(f"{Colors.BOLD} 10x-Outreach-Skill Setup{Colors.RESET}")
print(f"{Colors.BOLD}{'='*60}{Colors.RESET}\n")
script_dir = Path(__file__).parent.absolute()
os.chdir(script_dir)
# Check Python version
print_status("Checking Python version...")
if sys.version_info < (3, 9):
print_status(f"Python 3.9+ required. Found: {sys.version}", "error")
return False
print_status(f"Python {sys.version_info.major}.{sys.version_info.minor} detected", "success")
# Create virtual environment
venv_path = script_dir / '.venv'
if not venv_path.exists():
print_status("Creating virtual environment...")
subprocess.run([sys.executable, '-m', 'venv', str(venv_path)], check=True)
print_status("Virtual environment created", "success")
else:
print_status("Virtual environment already exists", "success")
# Determine pip path
if sys.platform == 'win32':
pip_path = venv_path / 'Scripts' / 'pip.exe'
python_path = venv_path / 'Scripts' / 'python.exe'
else:
pip_path = venv_path / 'bin' / 'pip'
python_path = venv_path / 'bin' / 'python'
# Upgrade pip
print_status("Upgrading pip...")
subprocess.run([str(pip_path), 'install', '--upgrade', 'pip'],
capture_output=True, check=True)
print_status("Pip upgraded", "success")
# Install requirements
requirements_file = script_dir / 'requirements.txt'
if requirements_file.exists():
print_status("Installing dependencies (this may take a moment)...")
result = subprocess.run(
[str(pip_path), 'install', '-r', str(requirements_file)],
capture_output=True,
text=True
)
if result.returncode != 0:
print_status(f"Failed to install dependencies: {result.stderr}", "error")
return False
print_status("Dependencies installed", "success")
else:
print_status("requirements.txt not found", "warning")
# Create .env if not exists
env_file = script_dir / '.env'
env_example = script_dir / '.env.example'
if not env_file.exists() and env_example.exists():
print_status("Creating .env from template...")
shutil.copy(env_example, env_file)
print_status(".env file created - please fill in your credentials", "warning")
elif env_file.exists():
print_status(".env file already exists", "success")
# Create necessary directories
directories = [
'input/sheets',
'output/logs',
'output/sent',
'output/drafts',
'output/reports',
'templates/outreach',
'templates/promotional',
'templates/follow-up',
'templates/newsletter',
'templates/custom',
'samples/signatures',
'samples/attachments',
]
print_status("Creating directory structure...")
for dir_path in directories:
(script_dir / dir_path).mkdir(parents=True, exist_ok=True)
print_status("Directories created", "success")
# Create credentials directory
creds_dir = script_dir / 'credentials'
creds_dir.mkdir(exist_ok=True)
# Create .gitignore
gitignore_path = script_dir / '.gitignore'
if not gitignore_path.exists():
print_status("Creating .gitignore...")
gitignore_content = """.env
.venv/
__pycache__/
*.pyc
credentials/
token.json
token.pickle
output/sent/
output/logs/
*.log
.DS_Store
Thumbs.db
"""
gitignore_path.write_text(gitignore_content)
print_status(".gitignore created", "success")
# Create setup complete marker
(script_dir / '.setup_complete').touch()
print(f"\n{Colors.BOLD}{'='*60}{Colors.RESET}")
print(f"{Colors.GREEN}{Colors.BOLD} Setup Complete!{Colors.RESET}")
print(f"{Colors.BOLD}{'='*60}{Colors.RESET}\n")
print(f"{Colors.YELLOW}Next Steps:{Colors.RESET}")
print("1. Edit .env file with your Google OAuth2 credentials")
print("2. Run: python scripts/auth_setup.py (to authenticate)")
print("3. Prepare your Google Sheet with recipient data")
print("4. Create email templates in templates/ folder")
print(f"5. Use /outreach command in Claude Code\n")
print(f"{Colors.BLUE}Virtual Environment:{Colors.RESET}")
if sys.platform == 'win32':
print(f" Activate: .venv\\Scripts\\activate")
print(f" Python: .venv\\Scripts\\python.exe")
else:
print(f" Activate: source .venv/bin/activate")
print(f" Python: .venv/bin/python")
return True
if __name__ == '__main__':
success = main()
sys.exit(0 if success else 1)