-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (53 loc) · 1.98 KB
/
Copy pathMakefile
File metadata and controls
66 lines (53 loc) · 1.98 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
# SkynetClaw — common tasks.
#
# make install create .venv and install dependencies
# make setup install + create config from templates + init the database
# make run start the backend
# make test run the backend test suite
# make health probe a running instance
# make clean remove caches and the virtualenv (keeps your config and data)
#
# Windows users without make: use install.bat / start.bat, or the commands in README.
PYTHON ?= python3
VENV ?= .venv
BIN := $(VENV)/bin
HOST ?= 127.0.0.1
PORT ?= 8766
# On Windows the venv layout differs.
ifeq ($(OS),Windows_NT)
BIN := $(VENV)/Scripts
PYTHON ?= python
endif
.PHONY: help install setup config db run test health lint clean
help:
@echo "SkynetClaw"
@echo " make setup one-time: venv + deps + config + database"
@echo " make run start the backend on $(HOST):$(PORT)"
@echo " make test run the test suite"
@echo " make health probe a running instance"
$(VENV):
$(PYTHON) -m venv $(VENV)
install: $(VENV)
$(BIN)/python -m pip install --upgrade pip
$(BIN)/pip install -r backend/requirements.txt
config:
@test -f backend/settings.json || (cp backend/settings.example.json backend/settings.json && \
echo "created backend/settings.json — edit it to choose your model")
@test -f .env || (test -f .env.example && cp .env.example .env && echo "created .env") || true
db:
cd backend && ../$(BIN)/python migrate.py up
setup: install config db
@echo
@echo "Setup complete. Next: make run"
run:
cd backend && ../$(BIN)/python -m uvicorn main:app --host $(HOST) --port $(PORT)
test:
cd backend && ../$(BIN)/python -m pytest -q
health:
@curl -sf http://$(HOST):$(PORT)/api/system/health || \
echo "no response — is the server running? (make run)"
clean:
rm -rf $(VENV)
find . -type d -name __pycache__ -prune -exec rm -rf {} +
find . -type d -name .pytest_cache -prune -exec rm -rf {} +
@echo "removed caches and the virtualenv (config and databases were kept)"