.PHONY: dev clean lint format test install # Variables VENV_DIR = .venv PYTHON = $(VENV_DIR)/bin/python UV = $(VENV_DIR)/bin/uv PYTEST = $(VENV_DIR)/bin/pytest RUFF = $(VENV_DIR)/bin/ruff BLACK = $(VENV_DIR)/bin/black ISORT = $(VENV_DIR)/bin/isort # Default target .DEFAULT_GOAL := help pyenv-setup: pyenv install $(PYTHON_VERSION) --skip-existing pyenv local $(PYTHON_VERSION) @echo "Python $(PYTHON_VERSION) set as local version" pip install uv @echo "uv installed in pyenv environment" help: @echo "Available commands:" @echo " make dev - Setup virtual environment and install dev dependencies" @echo " make install - Install only production dependencies" @echo " make lint - Run linting checks with ruff" @echo " make format - Format code with black and isort" @echo " make test - Run tests with pytest" @echo " make clean - Remove virtual environment and build artifacts" # Create virtual environment and install dev dependencies dev: pyenv-setup $(VENV_DIR) uv pip install -e ".[dev]" @echo "Development environment ready!" # Create virtual environment if it doesn't exist $(VENV_DIR): uv venv @echo "Virtual environment created at $(VENV_DIR)" # Run linting checks lint: $(RUFF) check src tests $(RUFF) format --check src tests # Format code format: $(ISORT) src tests $(BLACK) src tests $(RUFF) format src tests # Run tests test: $(PYTEST) tests/ -v # Clean up clean: rm -rf $(VENV_DIR) rm -rf build/ rm -rf dist/ rm -rf *.egg-info rm -rf .pytest_cache rm -rf .ruff_cache rm -rf .coverage find . -type d -name "__pycache__" -exec rm -rf {} + find . -type f -name "*.pyc" -delete find . -type f -name "*.pyo" -delete find . -type f -name "*.pyd" -delete find . -type f -name ".coverage" -delete find . -type f -name ".DS_Store" -delete