-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathsetup.sh
More file actions
101 lines (88 loc) · 3.41 KB
/
Copy pathsetup.sh
File metadata and controls
101 lines (88 loc) · 3.41 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
#!/bin/bash
# setup.sh — one-time setup script, shared across all homeworks in this repo
#
# Run this script once from the repo root, right after cloning:
# bash setup.sh
#
# What it does:
# 1. Checks that Python 3 is installed
# 2. Creates a Python virtual environment (venv) at the repo root
# 3. Installs all required packages (requirements.txt is shared/cumulative
# across homeworks, so you only set this up once)
# 4. Creates your .env file from the template (if it doesn't exist yet)
#
# After running this script, you still need to:
# - Add your OpenRouter API key to .env
# - Activate the venv (source venv/bin/activate) and cd into the homework
# folder you're working on (e.g. "homework 0") to run its app.py
set -e # stop immediately if any command fails
echo ""
echo "========================================"
echo " AI Resume Agent — Setup"
echo "========================================"
echo ""
# ----------------------------------------------------------------
# STEP 1: Check Python version
# ----------------------------------------------------------------
echo "Step 1: Checking Python version..."
if ! command -v python3 &> /dev/null; then
echo ""
echo "ERROR: Python 3 is not installed or not on your PATH."
echo "Please install Python 3 from https://www.python.org/downloads/"
exit 1
fi
PYTHON_VERSION=$(python3 --version)
echo " Found: $PYTHON_VERSION"
# ----------------------------------------------------------------
# STEP 2: Create virtual environment
# ----------------------------------------------------------------
echo ""
echo "Step 2: Creating virtual environment (venv)..."
# A virtual environment is an isolated Python installation just for this project.
# It keeps this project's packages separate from other Python projects on your machine.
if [ -d "venv" ]; then
echo " venv/ already exists — skipping creation."
else
python3 -m venv venv
echo " Created venv/"
fi
# ----------------------------------------------------------------
# STEP 3: Install dependencies
# ----------------------------------------------------------------
echo ""
echo "Step 3: Installing packages from requirements.txt..."
# Activate the venv so pip installs into it (not into your system Python)
source venv/bin/activate
pip install --quiet --upgrade pip
pip install --quiet -r requirements.txt
echo " All packages installed."
# ----------------------------------------------------------------
# STEP 4: Create .env file
# ----------------------------------------------------------------
echo ""
echo "Step 4: Setting up .env file..."
if [ -f ".env" ]; then
echo " .env already exists — skipping."
else
cp .env.example .env
echo " Created .env from .env.example"
echo ""
echo " *** ACTION REQUIRED ***"
echo " Open .env and replace 'paste-your-key-here' with your OpenRouter API key."
echo ""
fi
# ----------------------------------------------------------------
# DONE
# ----------------------------------------------------------------
echo "========================================"
echo " Setup complete!"
echo "========================================"
echo ""
echo "Next steps:"
echo " 1. If you haven't already, add your OpenRouter API key to .env"
echo " 2. Activate the virtual environment:"
echo " source venv/bin/activate"
echo " 3. Start the app:"
echo " python app.py"
echo " 4. Open your browser to: http://localhost:8080"
echo ""