VENV := venv
PYTHON := $(VENV)/bin/python
PIP := $(PYTHON) -m pip
TAG = v$(shell grep -E '^version = ".*"' pyproject.toml | head -1 | cut -d\" -f2)
RM := rm -rf

.PHONY: venv install lint test build check clean tag

venv:
	python -m venv $(VENV)
	$(PIP) install -U pip

install: venv
	$(PIP) install -e ".[dev]"

lint:
	$(PYTHON) -m ruff check .

test:
	$(PYTHON) -m pytest

build:
	$(PYTHON) -m build

check: lint test build
	$(PYTHON) -m twine check dist/*

clean:
	$(RM) build dist *.egg-info .pytest_cache .ruff_cache
	find . -type d -name __pycache__ -prune -exec rm -rf {} +

tag:
	git tag $(TAG)
