Skip to main content
Glama
deps.mk•8.74 kB
# ============================================================================ # deps.mk - Dependency Management # ============================================================================ # Provides: Poetry lock file management, installation, export # Include in main Makefile with: -include .makefiles/deps.mk # # Extracted from: claude-mpm production Makefile (97 targets) # Dependencies: common.mk (for colors, PYTHON) # Last updated: 2025-11-21 # ============================================================================ # # Workflow for updating dependencies: # 1. make lock-check - Verify current lock state # 2. make lock-update - Update to latest compatible versions # 3. make test - Test with updated deps # 4. git diff poetry.lock - Review changes # 5. git add poetry.lock - Commit if tests pass # # For reproducible installs: # make lock-install - Install exact versions from lock file # # For CI/CD integration: # make lock-check - Fail if lock file is outdated # make lock-export - Generate requirements.txt for Docker # ============================================================================ # ============================================================================ # Dependency Management Target Declarations # ============================================================================ .PHONY: lock-deps lock-update lock-check lock-install lock-export lock-info .PHONY: install install-prod install-dev # ============================================================================ # Lock File Management # ============================================================================ lock-deps: ## Lock dependencies without updating (poetry.lock) @echo "$(YELLOW)šŸ”’ Locking dependencies...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry lock --no-update; \ echo "$(GREEN)āœ“ Dependencies locked in poetry.lock$(NC)"; \ else \ echo "$(RED)āœ— Poetry not found. Install: pip install poetry$(NC)"; \ exit 1; \ fi lock-update: ## Update all dependencies to latest compatible versions @echo "$(YELLOW)ā¬†ļø Updating dependencies...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry update; \ echo "$(GREEN)āœ“ Dependencies updated$(NC)"; \ echo "$(YELLOW)šŸ“‹ Review changes with: git diff poetry.lock$(NC)"; \ else \ echo "$(RED)āœ— Poetry not found. Install: pip install poetry$(NC)"; \ exit 1; \ fi lock-check: ## Check if poetry.lock is up to date with pyproject.toml @echo "$(YELLOW)šŸ” Checking lock file consistency...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry check; \ poetry lock --check; \ echo "$(GREEN)āœ“ Lock file is up to date$(NC)"; \ else \ echo "$(RED)āœ— Poetry not found. Install: pip install poetry$(NC)"; \ exit 1; \ fi lock-install: ## Install dependencies from lock file (reproducible) @echo "$(YELLOW)šŸ“¦ Installing from lock file...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry install --sync; \ echo "$(GREEN)āœ“ Dependencies installed from poetry.lock$(NC)"; \ else \ echo "$(RED)āœ— Poetry not found. Install: pip install poetry$(NC)"; \ exit 1; \ fi lock-export: ## Export locked dependencies to requirements.txt format @echo "$(YELLOW)šŸ“¤ Exporting dependencies...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry export -f requirements.txt --output requirements.txt --without-hashes; \ poetry export -f requirements.txt --output requirements-dev.txt --with dev --without-hashes; \ echo "$(GREEN)āœ“ Exported to requirements.txt and requirements-dev.txt$(NC)"; \ else \ echo "$(RED)āœ— Poetry not found. Install: pip install poetry$(NC)"; \ exit 1; \ fi lock-info: ## Display dependency lock information @echo "$(BLUE)════════════════════════════════════════$(NC)" @echo "$(BLUE)Dependency Lock Information$(NC)" @echo "$(BLUE)════════════════════════════════════════$(NC)" @if [ -f poetry.lock ]; then \ echo "$(GREEN)āœ“ poetry.lock exists$(NC)"; \ echo ""; \ echo "Lock file modified: $$(stat -f %Sm -t '%Y-%m-%d %H:%M:%S' poetry.lock 2>/dev/null || stat -c %y poetry.lock 2>/dev/null || echo 'unknown')"; \ echo "Lock file size: $$(du -h poetry.lock | cut -f1)"; \ echo ""; \ if command -v poetry >/dev/null 2>&1; then \ echo "$(YELLOW)Direct dependencies:$(NC)"; \ poetry show --tree --only main | head -20; \ fi; \ else \ echo "$(RED)āœ— poetry.lock not found$(NC)"; \ echo "$(YELLOW) Run: make lock-deps$(NC)"; \ fi # ============================================================================ # Installation Targets # ============================================================================ install: ## Install project in development mode with all dependencies @echo "$(YELLOW)šŸ“¦ Installing project in development mode...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry install; \ echo "$(GREEN)āœ“ Project installed with all dependencies$(NC)"; \ else \ echo "$(YELLOW)⚠ Poetry not found, falling back to pip...$(NC)"; \ $(PYTHON) -m pip install -e ".[dev]"; \ echo "$(GREEN)āœ“ Project installed with pip$(NC)"; \ fi install-prod: ## Install production dependencies only (no dev deps) @echo "$(YELLOW)šŸ“¦ Installing production dependencies...$(NC)" @if command -v poetry >/dev/null 2>&1; then \ poetry install --only main; \ echo "$(GREEN)āœ“ Production dependencies installed$(NC)"; \ else \ echo "$(YELLOW)⚠ Poetry not found, falling back to pip...$(NC)"; \ $(PYTHON) -m pip install -e .; \ echo "$(GREEN)āœ“ Production dependencies installed with pip$(NC)"; \ fi install-dev: install ## Alias for development installation # ============================================================================ # Virtual Environment Management # ============================================================================ # Note: Poetry manages its own virtual environments. # If you need manual venv management, add these targets: # # .PHONY: venv venv-clean # # venv: ## Create virtual environment # @echo "$(YELLOW)Creating virtual environment...$(NC)" # @$(PYTHON) -m venv .venv # @echo "$(GREEN)āœ“ Virtual environment created in .venv/$(NC)" # @echo "$(BLUE)Activate with: source .venv/bin/activate$(NC)" # # venv-clean: ## Remove virtual environment # @echo "$(YELLOW)Removing virtual environment...$(NC)" # @rm -rf .venv # @echo "$(GREEN)āœ“ Virtual environment removed$(NC)" # ============================================================================ # ============================================================================ # Dependency Management Best Practices # ============================================================================ # 1. Lock before committing: # Always run `make lock-check` before committing changes # # 2. Update dependencies regularly: # Run `make lock-update` weekly to get security patches # # 3. Review dependency changes: # Use `git diff poetry.lock` to review what changed # # 4. Test after updates: # Always run `make test` after `make lock-update` # # 5. CI/CD integration: # Add `make lock-check` to your CI pipeline # # 6. Docker builds: # Use `make lock-export` to generate requirements.txt for Docker # # 7. Reproducible builds: # Use `make lock-install` for deterministic installations # ============================================================================ # ============================================================================ # Usage Examples # ============================================================================ # Initial setup: # make install # Install all dependencies (dev + prod) # # Production deployment: # make install-prod # Install production dependencies only # # Update dependencies: # make lock-update # Update to latest compatible versions # make test # Test with updated dependencies # git add poetry.lock # Commit if tests pass # # CI/CD pipeline: # make lock-check # Verify lock file is current # make lock-install # Install from lock file # make test # Run tests # # Docker integration: # make lock-export # Generate requirements.txt # # Use requirements.txt in Dockerfile # # Troubleshooting: # make lock-info # View dependency tree # poetry show <package> # Check specific package # poetry why <package> # See why package is installed # ============================================================================

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bobmatnyc/mcp-skills'

If you have feedback or need assistance with the MCP directory API, please join our Discord server