Skip to content

Commit 095b310

Browse files
committed
chore: examples is a package, local dependency used
1 parent 10431ad commit 095b310

130 files changed

Lines changed: 165 additions & 11 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/lintcommit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
164164
status = subprocess.run(
165165
["git", "status", "--porcelain"],
166166
capture_output=True,
167-
text=True,
167+
text=True, check=False,
168168
)
169169
if status.stdout.strip():
170170
return LintResult(
@@ -178,7 +178,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
178178
result = subprocess.run(
179179
["git", "log", "--no-merges", git_range, "-z", "--format=%H%n%B"],
180180
capture_output=True,
181-
text=True,
181+
text=True, check=False,
182182
)
183183
if result.returncode != 0:
184184
return LintResult(git_error=result.stderr.strip())

.github/scripts/tests/test_lintcommit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
1111

12-
import pytest
1312

1413
from lintcommit import lint_range, validate_message, validate_subject
1514

16-
1715
# region validate_subject: valid subjects
1816

1917

.github/scripts/tests/test_parse_sdk_branch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test():
7474
for input_text, expected in test_cases:
7575
result = parse_sdk_branch(input_text)
7676
# Assert is expected in test functions
77-
assert result == expected, ( # noqa: S101
77+
assert result == expected, (
7878
f"Expected '{expected}' but got '{result}' for input: {input_text[:50]}..."
7979
)
8080

.github/workflows/deploy-examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ "main", "development"]
66
paths:
77
- 'packages/aws-durable-execution-sdk-python/src/**'
8-
- 'packages/aws-durable-execution-sdk-python/examples/**'
8+
- 'packages/examples/**'
99
- '.github/workflows/deploy-examples.yml'
1010
workflow_dispatch:
1111

@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Get examples from catalog
2828
id: get-examples
29-
working-directory: ./packages/aws-durable-execution-sdk-python/examples
29+
working-directory: ./packages/examples
3030
run: |
3131
echo "examples=$(jq -c '.examples | map(select(.integration == true))' examples-catalog.json)" >> $GITHUB_OUTPUT
3232

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: Get integration examples
8686
id: get-examples
87-
working-directory: language-sdk/packages/aws-durable-execution-sdk-python/examples
87+
working-directory: language-sdk/packages/examples
8888
run: |
8989
echo "examples=$(jq -c '.examples | map(select(.integration == true)) | .[0:2]' examples-catalog.json)" >> $GITHUB_OUTPUT
9090

.github/workflows/pypi-publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929

3030
steps:
3131
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32-
32+
with:
33+
ref: ${{ github.event.release.target_commitish }}
3334
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3435
with:
3536
python-version: "3.11"

.github/workflows/update-sam-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Update SAM Template
33
on:
44
pull_request:
55
paths:
6-
- "examples/**"
6+
- "packages/examples/**"
77

88
permissions:
99
contents: write
@@ -27,7 +27,7 @@ jobs:
2727
python-version: "3.13"
2828

2929
- name: Generate SAM template
30-
run: python packages/aws-durable-execution-sdk-python/examples/scripts/generate_sam_template.py
30+
run: python packages/examples/scripts/generate_sam_template.py
3131

3232
- name: Commit and push changes
3333
run: |

packages/aws-durable-execution-sdk-python/examples/cli.py renamed to packages/examples/cli.py

File renamed without changes.

packages/aws-durable-execution-sdk-python/examples/examples-catalog.json renamed to packages/examples/examples-catalog.json

File renamed without changes.

packages/examples/pyproject.toml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "aws-durable-execution-sdk-python-examples"
7+
version = "0.0.0"
8+
description = "Examples for AWS Durable Execution SDK for Python"
9+
requires-python = ">=3.11"
10+
dependencies = [
11+
"aws-durable-execution-sdk-python",
12+
"aws-durable-execution-sdk-python-testing",
13+
]
14+
15+
[tool.hatch.build.targets.wheel]
16+
packages = ["src"]
17+
18+
[tool.hatch.envs.default]
19+
workspace.members = ["../aws-durable-execution-sdk-python"]
20+
21+
[tool.hatch.envs.hatch-test]
22+
default-args = ["test"]
23+
24+
[tool.pytest.ini_options]
25+
testpaths = ["test"]
26+
addopts = "-v --strict-markers"
27+
pythonpath = ["."]
28+
markers = [
29+
"example: marks tests as example tests (deselect with '-m \"not example\"')",
30+
"durable_execution: marks tests that use the durable_runner fixture (not used for test selection)",
31+
]
32+
[tool.hatch.envs.test]
33+
dependencies = [
34+
"coverage[toml]",
35+
"pytest",
36+
"pytest-cov",
37+
"aws-durable-execution-sdk-python-testing",
38+
]
39+
40+
[tool.hatch.envs.test.scripts]
41+
examples = "pytest --runner-mode=local -m example test/ -v"
42+
examples-integration = "pytest --runner-mode=cloud -m example test/ -v {args}"
43+
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml -v test/"
44+
45+
[tool.hatch.envs.examples]
46+
dependencies = [
47+
"aws-durable-execution-sdk-python-testing>=1.0.0",
48+
]
49+
50+
[tool.hatch.envs.examples.scripts]
51+
cli = "python cli.py {args}"
52+
bootstrap = "python cli.py bootstrap"
53+
generate-sam-template = "python scripts/generate_sam_template.py"
54+
build = "python cli.py build"
55+
deploy = "python cli.py deploy {args}"
56+
invoke = "python cli.py invoke {args}"
57+
get = "python cli.py get {args}"
58+
history = "python cli.py history {args}"
59+
policy = "python cli.py policy {args}"
60+
list = "python cli.py list"
61+
clean = "rm -rf build .aws-sam *.zip"
62+
63+
[tool.ruff]
64+
line-length = 88
65+
target-version = "py311"
66+
67+
[tool.ruff.lint]
68+
preview = true
69+
select = ["TID252"] # Enforce absolute imports (ban relative imports)
70+
71+
[tool.ruff.lint.isort]
72+
known-first-party = ["aws_durable_execution_sdk_python"]
73+
force-single-line = false
74+
lines-after-imports = 2
75+
76+
[tool.ruff.lint.per-file-ignores]
77+
"test/**" = [
78+
"ARG001",
79+
"ARG002",
80+
"ARG005",
81+
"S101",
82+
"PLR2004",
83+
"SIM117",
84+
"TRY301",
85+
]

0 commit comments

Comments
 (0)