Skip to content

Commit f0a6c08

Browse files
authored
feat: add python SDK examples and CLI tool for managing them (#15)
* feat: add python SDK examples and CLI tool for managing them * fix: update deployment script to package python files at root level * fix: skip wait for callback in integration test
1 parent 182f663 commit f0a6c08

37 files changed

Lines changed: 1336 additions & 284 deletions

.github/workflows/deploy-examples.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ jobs:
8585
FUNCTION_NAME="${EXAMPLE_NAME_CLEAN}-Python"
8686
fi
8787
88-
# Extract handler file name
89-
HANDLER_FILE=$(echo "${{ matrix.example.handler }}" | sed 's/\.handler$//')
90-
91-
echo "Deploying $HANDLER_FILE as $FUNCTION_NAME"
92-
hatch run examples:deploy "$HANDLER_FILE" "$FUNCTION_NAME"
88+
echo "Deploying ${{ matrix.example.name }} as $FUNCTION_NAME"
89+
hatch run examples:deploy "${{ matrix.example.name }}" --function-name "$FUNCTION_NAME"
9390
9491
# Store function name for later steps
9592
echo "FUNCTION_NAME=$FUNCTION_NAME" >> $GITHUB_ENV

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ dist/
2929
.kiro/
3030
.idea
3131
.env
32+
33+
examples/build/*
34+
examples/*.zip

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,47 @@ Mimic the package structure in the src/aws_durable_execution_sdk_python director
121121
Name your module so that src/mypackage/mymodule.py has a dedicated unit test file
122122
tests/mypackage/mymodule_test.py
123123

124+
## Examples and Deployment
125+
126+
The project includes a unified CLI tool for managing examples, deployment, and AWS account setup:
127+
128+
### Bootstrap AWS Account
129+
```bash
130+
# Set up IAM role and KMS key for durable functions
131+
export AWS_ACCOUNT_ID=your-account-id
132+
hatch run examples:bootstrap
133+
```
134+
135+
### Build and Deploy Examples
136+
```bash
137+
# Build all examples with dependencies
138+
hatch run examples:build
139+
140+
# Generate SAM template for all examples
141+
hatch run examples:generate-sam
142+
143+
# List available examples
144+
hatch run examples:list
145+
146+
# Deploy specific example (when durable functions are available)
147+
hatch run examples:deploy "Hello World"
148+
```
149+
150+
### Other CLI Commands
151+
```bash
152+
# Invoke deployed function
153+
hatch run examples:invoke function-name --payload '{}'
154+
155+
# Get execution details
156+
hatch run examples:get execution-arn
157+
158+
# Get execution history
159+
hatch run examples:history execution-arn
160+
161+
# Clean build artifacts
162+
hatch run examples:clean
163+
```
164+
124165
## Coverage
125166
```
126167
hatch run test:cov

examples/.env.template

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/README.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/build.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)