.PHONY: lint fmt test gate deps

VENV := $(wildcard .venv/bin/)
RUFF := $(if $(VENV),.venv/bin/ruff,ruff)
PYTEST := $(if $(VENV),.venv/bin/pytest,pytest)
PIP_COMPILE := $(if $(VENV),.venv/bin/pip-compile,pip-compile)

lint:
	$(RUFF) check .
	$(RUFF) format --check .

fmt:
	$(RUFF) check --fix .
	$(RUFF) format .

test:
	$(PYTEST) -q

gate: lint test

deps:
	$(PIP_COMPILE) --output-file=requirements.txt pyproject.toml
	$(PIP_COMPILE) --extra=dev --output-file=requirements-dev.txt pyproject.toml
