# Makefile for clipai

# Tool definitions
UV = uv
PYTEST = $(UV) run pytest

.PHONY: all install test build clean publish publish-test

# Default target: install dependencies, build package, and run tests
all: install build test

# Install dependencies and sync virtual environment (with the package in editable mode)
install:
	$(UV) sync

# Run the test suite
test:
	$(PYTEST)

# Build source distribution and wheel
build:
	$(UV) build

# Clean up all build and test artifacts
clean:
	rm -rf dist/ build/ *.egg-info .pytest_cache .venv
	find . -type d -name "__pycache__" -exec rm -rf {} +
	find . -type f -name "*.pyc" -delete

# Publish distributions to PyPI
publish: build
	$(UV) publish

# Publish distributions to TestPyPI
publish-test: build
	$(UV) publish --publish-url https://test.pypi.org/legacy/
