-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-all.sh
More file actions
executable file
·56 lines (50 loc) · 1.75 KB
/
Copy pathrun-all.sh
File metadata and controls
executable file
·56 lines (50 loc) · 1.75 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
#!/usr/bin/env bash
# Mac / Linux: one-shot setup, tests, analysis, and Streamlit.
set -euo pipefail
cd "$(dirname "$0")"
if [[ ! -x .venv/bin/python ]]; then
python3 -m venv .venv
fi
# shellcheck source=/dev/null
source .venv/bin/activate
# Speed up repeat runs: skip dependency install unless missing or forced.
if [[ "${RUN_ALL_SKIP_INSTALL:-0}" != "1" ]]; then
if ! python -c "import singapore_eda" >/dev/null 2>&1; then
python -m pip install -U pip
pip install -e ".[dev]"
fi
else
echo "=== RUN_ALL_SKIP_INSTALL=1, skipping package install ==="
fi
mkdir -p data/raw
if [[ ! -f data/raw/median_rent_hdb.csv ]]; then
echo ""
echo "=== Downloading official median rent (quarterly, full history; needs network) ==="
hdb-rent-download -o data/raw/median_rent_hdb.csv || true
fi
if [[ ! -f data/raw/hdb_resale_2017_onwards.csv ]]; then
echo ""
if [[ -n "${HDB_MAX_ROWS:-}" ]]; then
echo "=== Downloading resale CSV (HDB_MAX_ROWS=$HDB_MAX_ROWS; needs network) ==="
hdb-download -o data/raw/hdb_resale_2017_onwards.csv --max-rows "$HDB_MAX_ROWS" --latest-first || true
else
echo "=== Downloading full Jan-2017+ resale tranche (comprehensive; can take a while; set HDB_MAX_ROWS to cap) ==="
hdb-download -o data/raw/hdb_resale_2017_onwards.csv || true
fi
fi
if [[ ! -f data/raw/hdb_resale_2017_onwards.csv ]]; then
echo ""
echo "=== No download; using tests/fixtures/hdb_sample.csv for analysis ==="
ANL=(python scripts/run_analysis.py --input tests/fixtures/hdb_sample.csv)
else
ANL=(python scripts/run_analysis.py)
fi
echo ""
echo "=== Tests ==="
python -m pytest tests -q
echo ""
echo "=== Analysis (console summary) ==="
"${ANL[@]}"
echo ""
echo "=== Streamlit (Ctrl+C to stop; opens in your browser) ==="
streamlit run streamlit_app.py