# GuichetOI ML — common dev shortcuts # # Usage: # make install Install Python deps into ./.venv # make test Run the pytest suite (171 tests, ~12 s) # make test-fast Run only the cms_generator tests (no model load, <2 s) # make demo Launch the Streamlit demo # make audit Re-run the 11-demande audit # make lint Run mypy on the business-logic modules # make clean Remove caches, temp outputs, __pycache__ # # On Windows install GNU make via: # winget install GnuWin32.Make # Or invoke any target's commands directly in PowerShell. PYTHON ?= .venv/Scripts/python.exe PIP ?= .venv/Scripts/pip.exe STREAMLIT ?= .venv/Scripts/streamlit.exe UVICORN ?= .venv/Scripts/uvicorn.exe PYTEST_ARGS = -q .PHONY: help install test test-fast test-engine test-cms test-inference \ demo api docker release lint typecheck ruff clean help: @echo "GuichetOI ML — make targets" @echo " install pip install -e .[dev,ui] + requirements.txt pins" @echo " test full pytest suite (181 tests)" @echo " test-fast cms_generator tests only (no model load)" @echo " test-engine recommendation engine tests" @echo " test-inference inference post-process tests" @echo " demo streamlit run apps/streamlit_demo.py" @echo " api uvicorn guichetoi.api.main:app (port 8000)" @echo " docker docker build -t guichetoi-ml ." @echo " release build + push image to GHCR (for Render deploy)" @echo " lint ruff check + mypy on src/" @echo " clean remove __pycache__, .pytest_cache, outputs/, *.pyc" install: $(PIP) install -e ".[dev,ui]" $(PIP) install -r requirements.txt # ── Tests ──────────────────────────────────────────────────────────────── test: $(PYTHON) -m pytest $(PYTEST_ARGS) test-fast: $(PYTHON) -m pytest tests/test_cms_generator.py $(PYTEST_ARGS) test-engine: $(PYTHON) -m pytest tests/test_recommendation_engine.py $(PYTEST_ARGS) test-inference: $(PYTHON) -m pytest tests/test_inference_postprocess.py $(PYTEST_ARGS) # ── Run ────────────────────────────────────────────────────────────────── demo: $(STREAMLIT) run apps/streamlit_demo.py api: $(UVICORN) guichetoi.api.main:app --host 0.0.0.0 --port 8000 --reload docker: docker build -t guichetoi-ml . # ── Release (push image to GHCR for Render deploy) ─────────────────────── # Models are gitignored, so GitHub Actions can't build a complete image. # Run this locally — your working tree DOES have models/ on disk. # # One-time prep: # 1. Create a GitHub PAT with `write:packages` scope. # 2. echo $GHCR_PAT | docker login ghcr.io -u medaziz012 --password-stdin IMAGE ?= ghcr.io/medaziz012/guichetoi-ml TAG ?= $(shell git rev-parse --short HEAD) release: @echo "Building $(IMAGE):$(TAG) and $(IMAGE):latest" docker build -t $(IMAGE):$(TAG) -t $(IMAGE):latest . docker push $(IMAGE):$(TAG) docker push $(IMAGE):latest @echo "Pushed $(IMAGE):$(TAG) — Render will redeploy if autoDeploy: true" # ── Quality ────────────────────────────────────────────────────────────── lint typecheck: $(PYTHON) -m ruff check src/ tests/ $(PYTHON) -m mypy --config-file mypy.ini src/guichetoi/cms.py src/guichetoi/recommendation.py ruff: $(PYTHON) -m ruff check src/ tests/ # ── Cleanup ────────────────────────────────────────────────────────────── clean: -rm -rf __pycache__ tests/__pycache__ .pytest_cache .mypy_cache outputs/*.json outputs/*.xlsx -find . -name "*.pyc" -delete 2>/dev/null || true