Spaces:
Configuration error
Configuration error
File size: 4,128 Bytes
33ddb61 9203c28 33ddb61 9452c00 33ddb61 9203c28 33ddb61 9203c28 9452c00 9203c28 33ddb61 9203c28 33ddb61 9203c28 33ddb61 9203c28 33ddb61 9452c00 33ddb61 9203c28 33ddb61 | 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # 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
|