PYTHON_PATHS = treelang tests evaluation scripts cookbook/*.py

.PHONY: install format lint typecheck test docs cookbooks build check clean

install:
	uv sync --frozen --all-groups

format:
	uv run ruff check --fix $(PYTHON_PATHS)
	uv run ruff format $(PYTHON_PATHS)

lint:
	uv run ruff check $(PYTHON_PATHS)
	uv run ruff format --check $(PYTHON_PATHS)

typecheck:
	uv run mypy

test:
	uv run pytest

docs:
	uv run python scripts/generate_api_docs.py
	uv run python scripts/generate_provider_matrix.py
	uv run python scripts/generate_json_schemas.py
	uv run mkdocs build --strict

cookbooks:
	uv run python scripts/check_cookbooks.py

build:
	uv build

check: lint typecheck test
	uv run python scripts/generate_api_docs.py --check
	uv run python scripts/generate_provider_matrix.py --check
	uv run python scripts/generate_json_schemas.py --check
	uv run mkdocs build --strict
	$(MAKE) cookbooks
	$(MAKE) build

clean:
	rm -rf build dist .coverage coverage.xml .mypy_cache .pytest_cache .ruff_cache
