# RentCache Makefile .PHONY: help install dev test lint format clean server docs # Default target help: @echo "RentCache Development Commands" @echo "==============================" @echo "" @echo "Setup:" @echo " install Install dependencies" @echo " dev Install dev dependencies" @echo "" @echo "Development:" @echo " server Start development server" @echo " test Run tests" @echo " test-cov Run tests with coverage" @echo " lint Run linting" @echo " format Format code" @echo "" @echo "Database:" @echo " db-init Initialize database" @echo " db-reset Reset database" @echo "" @echo "Utilities:" @echo " clean Clean temporary files" @echo " docs Generate documentation" @echo " check Run all checks (lint, test, format)" # Installation install: uv sync dev: uv sync --all-extras # Development server server: uv run rentcache server --reload # Testing test: uv run pytest -v test-cov: uv run pytest --cov=src/rentcache --cov-report=html --cov-report=term test-watch: uv run pytest-watch --runner "uv run pytest" # Code quality lint: uv run ruff check src tests uv run mypy src format: uv run black src tests uv run ruff check src tests --fix check: lint test @echo "✅ All checks passed!" # Database management db-init: uv run python -c "import asyncio; from rentcache.models import Base; from sqlalchemy.ext.asyncio import create_async_engine; asyncio.run(create_async_engine('sqlite+aiosqlite:///./rentcache.db').begin().__aenter__().run_sync(Base.metadata.create_all))" db-reset: rm -f rentcache.db $(MAKE) db-init # CLI shortcuts create-key: @read -p "Key name: " name; \ read -p "Rentcast API key: " key; \ uv run rentcache create-key "$$name" "$$key" list-keys: uv run rentcache list-keys stats: uv run rentcache stats health: uv run rentcache health # Cleanup clean: find . -type d -name __pycache__ -delete find . -type f -name "*.pyc" -delete find . -type d -name "*.egg-info" -exec rm -rf {} + rm -rf .coverage rm -rf htmlcov/ rm -rf reports/ rm -rf build/ rm -rf dist/ # Documentation docs: @echo "📚 API documentation available at:" @echo " http://localhost:8000/docs (when server is running)" @echo " http://localhost:8000/redoc (alternative docs)" # Docker commands docker-build: docker build -t rentcache . docker-run: docker run -p 8000:8000 --env-file .env rentcache docker-dev: docker-compose up -d docker-logs: docker-compose logs -f rentcache docker-stop: docker-compose down # Production deployment helpers deploy-check: @echo "🚀 Pre-deployment checklist:" @echo " - [ ] Tests passing" @echo " - [ ] Environment variables configured" @echo " - [ ] Database migrations ready" @echo " - [ ] SSL certificates configured" @echo " - [ ] Monitoring setup" @echo " - [ ] Backup strategy in place" # Performance testing perf-test: @echo "⚡ Running performance tests..." uv run python -m pytest tests/ -m performance -v benchmark: @echo "📊 Running benchmarks..." # Add your benchmark commands here # Development environment env-copy: cp .env.example .env @echo "📝 .env file created from example. Please edit with your settings." setup: install env-copy db-init @echo "🎉 Setup complete! Run 'make server' to start development." # Release helpers version: @echo "Current version: $$(grep version pyproject.toml | head -1 | cut -d'"' -f2)" bump-version: @read -p "New version: " version; \ sed -i "s/version = .*/version = \"$$version\"/" pyproject.toml; \ echo "Version bumped to $$version" build: uv build publish: uv publish # Monitoring and debugging logs: tail -f rentcache.log monitor: watch -n 1 "curl -s http://localhost:8000/metrics | jq '.'" debug-server: uv run python -m debugpy --listen 5678 --wait-for-client -m rentcache.server # Quick shortcuts for common operations s: server t: test f: format l: lint c: clean