Skip to content

Commit 82bd79d

Browse files
SilanHehsilan
andauthored
feat: example scripts moved to root (#418)
* feat: example scripts moved to root * ci: fix missing otel dependency in deploy-examples * ci: update dev-examples and dev-otel env --------- Co-authored-by: hsilan <hsilan@amazon.com>
1 parent 9295641 commit 82bd79d

6 files changed

Lines changed: 36 additions & 30 deletions

File tree

.github/workflows/deploy-examples.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,12 @@ jobs:
5858
- name: Install Hatch
5959
run: pip install hatch
6060
- name: Build examples
61-
working-directory: ./packages/aws-durable-execution-sdk-python-examples
6261
run: |
63-
hatch run -- examples:pip install -e ../aws-durable-execution-sdk-python
62+
hatch run -- examples:pip install -e packages/aws-durable-execution-sdk-python packages/aws-durable-execution-sdk-python-otel
6463
hatch run examples:build
6564
6665
- name: Deploy Lambda function - ${{ matrix.example.name }}
6766
id: deploy
68-
working-directory: ./packages/aws-durable-execution-sdk-python-examples
6967
env:
7068
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
7169
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ jobs:
9797
rm -rf /tmp/aws/
9898
9999
- name: Deploy and test examples
100-
working-directory: language-sdk/packages/aws-durable-execution-sdk-python-examples
100+
working-directory: language-sdk
101101
env:
102102
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
103103
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
104104
INVOKE_ACCOUNT_ID: ${{ secrets.INVOKE_ACCOUNT_ID }}
105105
KMS_KEY_ARN: ${{ secrets.KMS_KEY_ARN }}
106106
run: |
107107
echo "Building examples..."
108-
hatch run -- examples:pip install -e ../testing-sdk
108+
hatch run -- examples:pip install -e packages/testing-sdk
109109
hatch run examples:build
110110
111111
# Get first integration example for testing

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ hatch fmt
9292
# Build distribution
9393
hatch build
9494

95-
# Examples deployment (from examples package)
96-
cd ../aws-durable-execution-sdk-python-examples
95+
# Examples deployment (from repo root)
9796
hatch run examples:build
9897
hatch run examples:deploy "Hello World"
9998
```
@@ -309,7 +308,7 @@ tests/mypackage/mymodule_test.py
309308
## Examples and Deployment
310309

311310
The project includes a unified CLI tool for managing examples, deployment, and AWS account setup.
312-
Run these commands from the examples package directory (`packages/aws-durable-execution-sdk-python-examples`).
311+
Run these commands from the **repository root**.
313312

314313
To run examples tests from the repo root:
315314
```bash

packages/aws-durable-execution-sdk-python-examples/pyproject.toml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,12 @@ requires-python = ">=3.11"
1010
dependencies = [
1111
"aws-durable-execution-sdk-python",
1212
"aws-durable-execution-sdk-python-testing",
13+
"aws-durable-execution-sdk-python-otel"
1314
]
1415

1516
[tool.hatch.build.targets.wheel]
1617
packages = ["src"]
1718

18-
[tool.hatch.envs.examples.scripts]
19-
cli = "python cli.py {args}"
20-
bootstrap = "python cli.py bootstrap"
21-
generate-sam-template = "python scripts/generate_sam_template.py"
22-
build = "python cli.py build"
23-
deploy = "python cli.py deploy {args}"
24-
invoke = "python cli.py invoke {args}"
25-
get = "python cli.py get {args}"
26-
history = "python cli.py history {args}"
27-
policy = "python cli.py policy {args}"
28-
list = "python cli.py list"
29-
clean = "rm -rf build .aws-sam *.zip"
30-
3119
[tool.ruff]
3220
line-length = 88
3321
target-version = "py311"

packages/aws-durable-execution-sdk-python-examples/test/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Tests run against the in-memory `DurableFunctionTestRunner`:
1212
- ✅ Validates local runner behavior
1313

1414
```bash
15-
# Run all example tests locally (default)
16-
hatch run test:examples
15+
# Run all example tests locally (default, from repo root)
16+
hatch run dev-examples:test
1717

1818
# Run with explicit mode flag
19-
pytest --runner-mode=local -m example examples/test/
19+
pytest --runner-mode=local -m example packages/aws-durable-execution-sdk-python-examples/test/
2020

2121
# Run specific test
22-
pytest --runner-mode=local -k test_hello_world examples/test/
22+
pytest --runner-mode=local -k test_hello_world packages/aws-durable-execution-sdk-python-examples/test/
2323
```
2424

2525
### Cloud Mode (Integration)
@@ -30,7 +30,7 @@ Tests run against actual AWS Lambda functions using `DurableFunctionCloudTestRun
3030
- ⚠️ Requires deployed functions
3131

3232
```bash
33-
# Deploy function first
33+
# Deploy function first (from repo root)
3434
hatch run examples:deploy "hello world" --function-name HelloWorld-Test
3535

3636
# Set environment variables for cloud testing
@@ -39,10 +39,10 @@ export LAMBDA_ENDPOINT=https://lambda.us-west-2.amazonaws.com
3939
export QUALIFIED_FUNCTION_NAME="HelloWorld-Test:\$LATEST"
4040
export LAMBDA_FUNCTION_TEST_NAME="hello world"
4141

42-
# Run tests
43-
pytest --runner-mode=cloud -k test_hello_world examples/test/
42+
# Run tests (from repo root)
43+
pytest --runner-mode=cloud -k test_hello_world packages/aws-durable-execution-sdk-python-examples/test/
4444

45-
# Or using hatch
45+
# Or using hatch (from repo root)
4646
hatch run test:examples-integration -k test_hello_world
4747
```
4848

@@ -116,4 +116,4 @@ result = runner.run(input="test", timeout=120) # Increase to 120s
116116

117117
**Solution**: Install dependencies:
118118
```bash
119-
hatch run test:examples # Installs dependencies automatically
119+
hatch run dev-examples:test # Installs dependencies automatically

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ typecheck = "mypy --install-types --non-interactive packages/aws-durable-executi
8181
workspace.members = [
8282
"packages/aws-durable-execution-sdk-python",
8383
"packages/aws-durable-execution-sdk-python-examples",
84+
"packages/aws-durable-execution-sdk-python-otel",
8485
]
8586
dependencies = [
8687
"pytest",
@@ -118,6 +119,26 @@ pre-install-commands = [
118119
[tool.hatch.envs.test-pypi-examples.scripts]
119120
test = "pytest packages/aws-durable-execution-sdk-python-examples/test {args}"
120121

122+
[tool.hatch.envs.examples]
123+
workspace.members = [
124+
"packages/aws-durable-execution-sdk-python",
125+
"packages/aws-durable-execution-sdk-python-examples",
126+
"packages/aws-durable-execution-sdk-python-otel",
127+
]
128+
129+
[tool.hatch.envs.examples.scripts]
130+
cli = "python packages/aws-durable-execution-sdk-python-examples/cli.py {args}"
131+
bootstrap = "python packages/aws-durable-execution-sdk-python-examples/cli.py bootstrap"
132+
generate-sam-template = "python packages/aws-durable-execution-sdk-python-examples/scripts/generate_sam_template.py"
133+
build = "python packages/aws-durable-execution-sdk-python-examples/cli.py build"
134+
deploy = "python packages/aws-durable-execution-sdk-python-examples/cli.py deploy {args}"
135+
invoke = "python packages/aws-durable-execution-sdk-python-examples/cli.py invoke {args}"
136+
get = "python packages/aws-durable-execution-sdk-python-examples/cli.py get {args}"
137+
history = "python packages/aws-durable-execution-sdk-python-examples/cli.py history {args}"
138+
policy = "python packages/aws-durable-execution-sdk-python-examples/cli.py policy {args}"
139+
list = "python packages/aws-durable-execution-sdk-python-examples/cli.py list"
140+
clean = "rm -rf packages/aws-durable-execution-sdk-python-examples/build packages/aws-durable-execution-sdk-python-examples/.aws-sam packages/aws-durable-execution-sdk-python-examples/*.zip"
141+
121142
[tool.ruff]
122143
line-length = 88
123144
target-version = "py311"

0 commit comments

Comments
 (0)