|
| 1 | +VENV := .venv |
| 2 | +PYTHON := $(VENV)/bin/python |
| 3 | +PIP := $(VENV)/bin/pip |
| 4 | + |
| 5 | +.PHONY: help install lint format typecheck test pre-commit clean |
| 6 | + |
| 7 | +help: |
| 8 | + @echo "Usage: make <target>" |
| 9 | + @echo "" |
| 10 | + @echo " install set up the virtual environment" |
| 11 | + @echo " lint run ruff" |
| 12 | + @echo " format run black" |
| 13 | + @echo " typecheck run mypy" |
| 14 | + @echo " test run pytest with coverage" |
| 15 | + @echo " pre-commit install pre-commit hooks" |
| 16 | + @echo " clean remove build artifacts and caches" |
| 17 | + |
| 18 | +$(VENV)/bin/activate: pyproject.toml |
| 19 | + python3 -m venv $(VENV) |
| 20 | + $(PIP) install --upgrade pip |
| 21 | + $(PIP) install -e "../cfb" |
| 22 | + $(PIP) install -e ".[dev]" |
| 23 | + touch $(VENV)/bin/activate |
| 24 | + |
| 25 | +install: $(VENV)/bin/activate |
| 26 | + @echo "Virtual environment ready at $(VENV)/" |
| 27 | + |
| 28 | +lint: $(VENV)/bin/activate |
| 29 | + $(VENV)/bin/ruff check miette tests |
| 30 | + |
| 31 | +format: $(VENV)/bin/activate |
| 32 | + $(VENV)/bin/black miette tests |
| 33 | + |
| 34 | +typecheck: $(VENV)/bin/activate |
| 35 | + $(VENV)/bin/mypy miette |
| 36 | + |
| 37 | +test: $(VENV)/bin/activate |
| 38 | + $(VENV)/bin/pytest --cov=miette --cov-report=term-missing |
| 39 | + |
| 40 | +pre-commit: $(VENV)/bin/activate |
| 41 | + $(VENV)/bin/pre-commit install |
| 42 | + |
| 43 | +clean: |
| 44 | + rm -rf $(VENV) build dist *.egg-info .mypy_cache .ruff_cache .pytest_cache __pycache__ |
| 45 | + find . -type d -name __pycache__ -exec rm -rf {} + |
| 46 | + find . -name "*.pyc" -delete |
0 commit comments