Makefile•2.38 kB
# Docker image configuration
IMAGE_NAME = nimbletools/mcp-ipinfo
VERSION ?= latest
.PHONY: help install dev-install format lint test clean run check all
help: ## Show this help message
	@echo 'Usage: make [target]'
	@echo ''
	@echo 'Available targets:'
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install the package
	uv pip install -e .
dev-install: ## Install the package with dev dependencies
	uv pip install -e ".[dev]"
format: ## Format code with ruff
	uv run ruff format src/ tests/
lint: ## Lint code with ruff
	uv run ruff check src/ tests/
lint-fix: ## Lint and fix code with ruff
	uv run ruff check --fix src/ tests/
typecheck: ## Type check code with mypy
	uv run mypy src/
test: ## Run tests with pytest
	uv run pytest tests/ -v
test-cov: ## Run tests with coverage
	uv run pytest tests/ -v --cov=src/mcp_ipinfo --cov-report=term-missing
build-push:
	docker buildx build --platform linux/amd64,linux/arm64 \
		-t $(IMAGE_NAME):$(VERSION) \
		-t $(IMAGE_NAME):latest \
		--push .
# Login to Docker Hub
login:
	docker login
# Clean up local images
clean-docker:
	docker rmi $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):latest 2>/dev/null || true
	
clean: ## Clean up build artifacts and cache
	find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
	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 d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name "build" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name "dist" -exec rm -rf {} + 2>/dev/null || true
run: ## Run the MCP server
	uv run python -m mcp_ipinfo.server
run-http: ## Run the MCP server with HTTP transport
	IPINFO_API_TOKEN=$${IPINFO_API_TOKEN} uv run python -m mcp_ipinfo.server
check: lint typecheck test ## Run linting, type checking, and tests
all: clean install format lint typecheck test ## Clean, install, format, lint, type check, and test
# Development shortcuts
fmt: format ## Alias for format
t: test ## Alias for test
l: lint ## Alias for lint