# The simulator imports only the standard library, so it needs no install.
PYTHON ?= python3

# Anything importing the package runs through the venv, created on first use.
VENV_PYTHON ?= .venv/bin/python

# Empty when VENV_PYTHON is overridden, so an override never bootstraps.
BOOTSTRAP := $(filter .venv/bin/python,$(VENV_PYTHON))


.PHONY: setup test lint check demo stub-fleet wiki observe

.venv/bin/python:
	$(PYTHON) -m venv .venv
	.venv/bin/pip install -e '.[dev]'

setup: .venv/bin/python

test: $(BOOTSTRAP)
	$(VENV_PYTHON) -m pytest -q

lint: $(BOOTSTRAP)
	$(VENV_PYTHON) -m ruff check src tests demo tools examples

# The prose gate covers the operator surface: every tracked page.
check: test lint

demo:
	$(PYTHON) demo/run_demo.py

wiki:
	tools/publish_wiki.sh

# The standing Prometheus + Grafana stack, provisioned from tools/observability/.
observe:
	cd tools/observability && docker compose up -d

# Six engine-protocol stubs on ports 8101-8106: the no-GPU path through the
# real router. Foreground; ^C stops the fleet.
stub-fleet: $(BOOTSTRAP)
	$(VENV_PYTHON) tools/stub_fleet.py --base-port 8101 --instances 6 --model stub
