|
| 1 | +VENV_BIN = python3 -m venv |
| 2 | +VENV_DIR ?= .venv |
| 3 | +VENV_ACTIVATE = $(VENV_DIR)/bin/activate |
| 4 | +VENV_RUN = . $(VENV_ACTIVATE) |
| 5 | + |
| 6 | +usage: ## Shows usage for this Makefile |
| 7 | + @cat Makefile | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' |
| 8 | + |
| 9 | +venv: $(VENV_ACTIVATE) |
| 10 | + |
| 11 | +$(VENV_ACTIVATE): pyproject.toml |
| 12 | + test -d .venv || $(VENV_BIN) .venv |
| 13 | + $(VENV_RUN); pip install --upgrade pip setuptools plux |
| 14 | + $(VENV_RUN); pip install -e .[dev] |
| 15 | + touch $(VENV_DIR)/bin/activate |
| 16 | + |
| 17 | +clean: |
| 18 | + rm -rf .venv/ |
| 19 | + rm -rf build/ |
| 20 | + rm -rf .eggs/ |
| 21 | + rm -rf *.egg-info/ |
| 22 | + |
| 23 | +install: venv ## Install dependencies |
| 24 | + $(VENV_RUN); python -m plux entrypoints |
| 25 | + |
| 26 | +dist: venv ## Create distribution |
| 27 | + $(VENV_RUN); python -m build |
| 28 | + |
| 29 | +publish: clean-dist venv dist ## Publish extension to pypi |
| 30 | + $(VENV_RUN); pip install --upgrade twine; twine upload dist/* |
| 31 | + |
| 32 | +entrypoints: venv # Generate plugin entrypoints for Python package |
| 33 | + $(VENV_RUN); python -m plux entrypoints |
| 34 | + |
| 35 | +format: ## Run ruff to format the whole codebase |
| 36 | + $(VENV_RUN); python -m ruff format .; python -m ruff check --output-format=full --fix . |
| 37 | + |
| 38 | +test: ## Run integration tests (requires LocalStack running with the Extension installed) |
| 39 | + $(VENV_RUN); pytest tests $(PYTEST_ARGS) |
| 40 | + |
| 41 | +sample: ## Deploy sample app |
| 42 | + echo "Creating stubs in WireMock ..." |
| 43 | + bin/create-stubs.sh |
| 44 | + echo "Deploying sample app into LocalStack via Terraform ..." |
| 45 | + (cd sample-app; tflocal init; tflocal apply -auto-approve) |
| 46 | + apiId=$$(awslocal apigateway get-rest-apis | jq -r '.items[0].id'); \ |
| 47 | + endpoint=https://$$apiId.execute-api.us-east-1.localhost.localstack.cloud/dev/time-off; \ |
| 48 | + echo "Invoking local API Gateway endpoint: $$endpoint"; \ |
| 49 | + curl -k -v $$endpoint | grep time_off_date |
| 50 | + |
| 51 | +clean-dist: clean |
| 52 | + rm -rf dist/ |
| 53 | + |
| 54 | +.PHONY: clean clean-dist dist install publish usage venv format test |
0 commit comments