Files
Timmy-time-dashboard/Makefile
Alexander Payne ca60483268 feat: pytest-cov configuration and test audit cleanup
Add full pytest-cov configuration with fail_under=60% threshold,
HTML/XML report targets, and proper exclude_lines. Fix websocket
history test to use public broadcast() API instead of manually
manipulating internals. Audit confirmed 491 tests at 71.2% coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:42:58 -05:00

126 lines
5.5 KiB
Makefile

.PHONY: install install-bigbrain dev test test-cov test-cov-html watch lint clean help \
docker-build docker-up docker-down docker-agent docker-logs docker-shell
VENV := .venv
PYTHON := $(VENV)/bin/python
PIP := $(VENV)/bin/pip
PYTEST := $(VENV)/bin/pytest
UVICORN := $(VENV)/bin/uvicorn
SELF_TDD := $(VENV)/bin/self-tdd
# ── Setup ─────────────────────────────────────────────────────────────────────
install: $(VENV)/bin/activate
$(PIP) install --quiet -e ".[dev]"
@echo "✓ Ready. Run 'make dev' to start the dashboard."
install-bigbrain: $(VENV)/bin/activate
$(PIP) install --quiet -e ".[dev,bigbrain]"
@if [ "$$(uname -m)" = "arm64" ] && [ "$$(uname -s)" = "Darwin" ]; then \
$(PIP) install --quiet "airllm[mlx]"; \
echo "✓ AirLLM + MLX installed (Apple Silicon detected)"; \
else \
echo "✓ AirLLM installed (PyTorch backend)"; \
fi
$(VENV)/bin/activate:
python3 -m venv $(VENV)
# ── Development ───────────────────────────────────────────────────────────────
dev:
$(UVICORN) dashboard.app:app --reload --host 0.0.0.0 --port 8000
# Print the local IP addresses your phone can use to reach this machine.
# Connect your phone to the same hotspot your Mac is sharing from,
# then open http://<IP>:8000 in your phone browser.
# The server auto-reloads on Python/template changes (--reload above).
# For CSS/static changes, just pull-to-refresh on your phone.
ip:
@echo ""
@echo " Open one of these on your phone: http://<IP>:8000"
@echo ""
@ipconfig getifaddr en0 2>/dev/null | awk '{print " en0 (Wi-Fi): http://" $$1 ":8000"}' || true
@ipconfig getifaddr en1 2>/dev/null | awk '{print " en1 (Ethernet): http://" $$1 ":8000"}' || true
@ipconfig getifaddr en2 2>/dev/null | awk '{print " en2: http://" $$1 ":8000"}' || true
@ifconfig 2>/dev/null | awk '/inet / && !/127\.0\.0\.1/ && !/::1/{print " " $$2 " → http://" $$2 ":8000"}' | head -5 || true
@echo ""
watch:
$(SELF_TDD) watch --interval 60
# ── Testing ───────────────────────────────────────────────────────────────────
test:
$(PYTEST) tests/ -q --tb=short
test-cov:
$(PYTEST) tests/ --cov=src --cov-report=term-missing --cov-report=xml -q
test-cov-html:
$(PYTEST) tests/ --cov=src --cov-report=term-missing --cov-report=html -q
@echo "✓ HTML coverage report: open htmlcov/index.html"
# ── Code quality ──────────────────────────────────────────────────────────────
lint:
@$(PYTHON) -m ruff check src/ tests/ 2>/dev/null || \
$(PYTHON) -m flake8 src/ tests/ 2>/dev/null || \
echo "No linter installed — run: pip install ruff"
# ── Housekeeping ──────────────────────────────────────────────────────────────
# ── Docker ────────────────────────────────────────────────────────────────────
docker-build:
docker build -t timmy-time:latest .
docker-up:
mkdir -p data
docker compose up -d dashboard
docker-down:
docker compose down
# Spawn one agent worker connected to the running dashboard.
# Override name/capabilities: make docker-agent AGENT_NAME=Echo AGENT_CAPABILITIES=summarise
docker-agent:
AGENT_NAME=$${AGENT_NAME:-Worker} \
AGENT_CAPABILITIES=$${AGENT_CAPABILITIES:-general} \
docker compose --profile agents up -d --scale agent=1 agent
docker-logs:
docker compose logs -f
docker-shell:
docker compose exec dashboard bash
# ── Housekeeping ──────────────────────────────────────────────────────────────
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true
rm -rf .pytest_cache htmlcov .coverage coverage.xml
help:
@echo ""
@echo " make install create venv + install dev deps"
@echo " make install-bigbrain install with AirLLM (big-model backend)"
@echo " make dev start dashboard at http://localhost:8000"
@echo " make ip print local IP addresses for phone testing"
@echo " make test run all tests"
@echo " make test-cov tests + coverage report (terminal + XML)"
@echo " make test-cov-html tests + HTML coverage report"
@echo " make watch self-TDD watchdog (60s poll)"
@echo " make lint run ruff or flake8"
@echo " make clean remove build artefacts and caches"
@echo ""
@echo " make docker-build build the timmy-time:latest image"
@echo " make docker-up start dashboard container"
@echo " make docker-agent add one agent worker (AGENT_NAME=Echo)"
@echo " make docker-down stop all containers"
@echo " make docker-logs tail container logs"
@echo " make docker-shell open a bash shell in the dashboard container"
@echo ""