# Makefile for modern Python 3.12 project management # Tools: uv, isort, black, mypy, hatchling, pytest SHELL := /bin/bash .SHELLFLAGS := -eu -o pipefail -c # Ensure uv is installed ENSURE_UV := which uv > /dev/null || pip install uv # Python version (update as needed) PYTHON_VERSION := 3.12 # Default target all: install format lint build test .PHONY: help help: ## Display this help message @echo "Usage: make [target]" @echo "" @echo "Targets:" @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) .PHONY: init init: ## Initialize the project environment @$(ENSURE_UV) @echo "Creating virtual environment..." @uv venv .PHONY: install install: ## Install project dependencies @$(ENSURE_UV) @echo "Installing dependencies..." @uv pip install -e .[dev] .PHONY: format format: ## Format code using isort and black @$(ENSURE_UV) @echo "Formatting code..." @uv pip install isort black @if [ -n "$(filter-out $@,$(MAKECMDGOALS))" ]; then \ echo "Formatting $(filter-out $@,$(MAKECMDGOALS))..."; \ uvx isort $(filter-out $@,$(MAKECMDGOALS)); \ uvx black $(filter-out $@,$(MAKECMDGOALS)); \ else \ uvx isort src tests; \ uvx black src tests; \ fi .PHONY: lint lint: ## Run linters and type-checkers (ruff and mypy) @$(ENSURE_UV) @echo "Linting and type-checking..." @uv pip install ruff mypy @uvx ruff format src tests @uvx ruff check --fix src tests @uv run mypy src .PHONY: test test: ## Run tests using pytest @$(ENSURE_UV) @echo "Running tests..." @uv pip install pytest pytest-asyncio @if [ -n "$(filter-out $@,$(MAKECMDGOALS))" ]; then \ uv run pytest -v $(filter-out $@,$(MAKECMDGOALS)); \ else \ uv run pytest; \ fi .PHONY: build build: ## Build the project using hatchling @$(ENSURE_UV) @echo "Building project..." @uv pip install hatchling @uvx hatchling build .PHONY: clean clean: ## Clean up build artifacts and cache @echo "Cleaning up..." @rm -rf build dist .eggs *.egg-info @find . -type d -name '__pycache__' -exec rm -rf {} + @find . -type f -name '*.pyc' -exec rm -f {} + @find . -type f -name '*.pyo' -exec rm -f {} + @find . -type f -name '*~' -exec rm -f {} + .PHONY: all all: install format lint build test ## Run all main tasks (install, format, lint, build, test) # AWS SSO configuration AWS_PROFILE_NAME := Geometric-PowerUserAccess AWS_SSO_START_URL := https://geometric.awsapps.com/start AWS_SSO_REGION := us-east-1 AWS_ACCOUNT_ID := 339713096219 AWS_ROLE_NAME := PowerUserAccess AWS_REGION := us-east-1 .PHONY: configure-aws-sso configure-aws-sso: ## Configure AWS SSO @echo "Configuring AWS SSO..." @mkdir -p ~/.aws @echo "# AWS SSO Configuration" > ~/.aws/config @echo "" >> ~/.aws/config @echo "[profile $(AWS_PROFILE_NAME)]" >> ~/.aws/config @echo "sso_session = geometric" >> ~/.aws/config @echo "sso_account_id = $(AWS_ACCOUNT_ID)" >> ~/.aws/config @echo "sso_role_name = $(AWS_ROLE_NAME)" >> ~/.aws/config @echo "region = $(AWS_REGION)" >> ~/.aws/config @echo "" >> ~/.aws/config @echo "[sso-session geometric]" >> ~/.aws/config @echo "sso_start_url = $(AWS_SSO_START_URL)" >> ~/.aws/config @echo "sso_region = $(AWS_SSO_REGION)" >> ~/.aws/config @echo "sso_registration_scopes = sso:account:access" >> ~/.aws/config @echo "AWS SSO configuration complete." @aws sso login --profile $(AWS_PROFILE_NAME)