Files
lincodex/ml/Makefile
T
2026-10-05 14:23:31 +03:00

52 lines
1.6 KiB
Makefile

.DEFAULT_GOAL := help
UV ?= uv
API_PREPARED ?= 0
.PHONY: help install generate check-generated build run fmt fmt-check lint lint-fix typecheck test test-contract check verify
help: ## Show available ML service commands.
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z0-9_-]+:.*## / {printf "%-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: ## Install locked service dependencies.
$(UV) sync --locked --all-groups
generate: ## Generate Pydantic models from the shared ML contract.
@if [ "$(API_PREPARED)" != "1" ]; then $(MAKE) -C ../api bundle; fi
cd codegen && $(UV) run --project .. datamodel-codegen
check-generated: ## Check Pydantic models against the bundled contract without rewriting them.
cd codegen && $(UV) run --project .. datamodel-codegen --check
build: ## Build the service wheel.
$(UV) build
run: ## Run the operational API on port 8000.
$(UV) run uvicorn lincodex_ml.main:app --host 0.0.0.0 --port 8000
fmt: ## Format Python source.
$(UV) run ruff format src tests
fmt-check: ## Check Python formatting.
$(UV) run ruff format --check src tests
lint: ## Run Ruff checks.
$(UV) run ruff check src tests
lint-fix: ## Apply safe Ruff fixes.
$(UV) run ruff check --fix src tests
typecheck: ## Run strict mypy checks.
$(UV) run mypy src
test: ## Run service tests.
$(UV) run pytest
test-contract: ## Check implementation against the shared OpenAPI contract.
$(UV) run pytest tests/test_contract.py
check: ## Run formatting, lint, type, tests, and package build.
$(MAKE) fmt-check lint typecheck test build
verify: ## Run the complete service validation suite.
$(MAKE) check-generated
$(MAKE) check test-contract