File size: 1,344 Bytes
41788c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
.PHONY: help install dev lint format type test cov run docker-build docker-run clean

PY ?= python3
APP := docsifer.main:app
PORT ?= 7860
HOST ?= 0.0.0.0

help:  ## Show this help
	@awk 'BEGIN {FS=":.*##"; printf "Targets:\n"} /^[a-zA-Z0-9_.-]+:.*##/ {printf "  %-16s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install:  ## Install runtime + dev dependencies (using pip + requirements.txt)
	$(PY) -m pip install --upgrade pip wheel
	$(PY) -m pip install -r requirements.txt
	$(PY) -m pip install pytest pytest-asyncio ruff mypy fakeredis

dev: install  ## Install in editable / dev mode
	$(PY) -m pip install -e .

lint:  ## Lint with ruff
	ruff check .

format:  ## Format with ruff
	ruff format .

type:  ## Type-check with mypy
	mypy

test:  ## Run pytest
	pytest -q

cov:  ## Run pytest with coverage
	pytest --cov=docsifer --cov-report=term-missing

run:  ## Run the dev server (uvicorn, autoreload)
	uvicorn $(APP) --host $(HOST) --port $(PORT) --reload

docker-build:  ## Build the production Docker image
	docker build -t docsifer:local .

docker-run:  ## Run the Docker image on $(PORT)
	docker run --rm -p $(PORT):7860 --env-file .env docsifer:local

clean:  ## Remove caches and build artefacts
	rm -rf .pytest_cache .ruff_cache .mypy_cache .coverage htmlcov dist build *.egg-info
	find . -name __pycache__ -type d -prune -exec rm -rf {} +