Makefile
Makefile
Some times you need a good starting point, here is mine:
# variablesPYVER := 3.10venv := .venvpython := $(venv)/bin/pythonpip := $(venv)/bin/pip
##@ Utility.PHONY: helphelp: ## Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\033[36m\033[0m\n"} /^[a-zA-Z\._-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Setup$(venv): @python$(PYVER) -m venv $(venv)
.PHONY: installinstall: $(venv) ## install $(pip) install . -r requirements.txt
##@ Development.PHONY: devdev: $(venv) ## install dev mode $(pip) install -e .[dev]
.PHONY: testtest: $(venv) ## run tests $(python) -m pytest tests
.PHONY: lintlint: $(venv) ## run linting check $(python) -m ruff ./src
.PHONY: formatformat: $(venv) ## fomat code using ruff $(python) -m ruff format src test
.PHONY: requirements.txtrequirements.txt: ## update requirements.txt, e.g. make requirements.txt @test -d /tmp/venv && rm -r /tmp/venv || true @$(python) -m venv /tmp/venv @/tmp/venv/bin/python -m pip -q install pip -U @/tmp/venv/bin/python -m pip -q install . --progress-bar off @/tmp/venv/bin/python -m pip freeze > requirements.txt