Skip to content

Commit d238353

Browse files
Alex Wangwangyb-A
authored andcommitted
Add slack notification, pin hatch version, update ruff config
1 parent 8f08252 commit d238353

10 files changed

Lines changed: 79 additions & 37 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
python-version: ${{ matrix.python-version }}
4343
- name: Install Hatch
4444
run: |
45-
python -m pip install hatch==1.15.0
45+
python -m pip install hatch==1.16.5
4646
- name: static analysis
4747
run: hatch fmt --check
4848
- name: type checking

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
python-version: ${{ matrix.python-version }}
4343

4444
- name: Install Hatch
45-
run: python -m pip install hatch==1.15.0
45+
run: python -m pip install hatch==1.16.5
4646

4747
- name: Setup and run Testing SDK
4848
working-directory: testing-sdk
@@ -102,7 +102,7 @@ jobs:
102102
env:
103103
AWS_DURABLE_SDK_URL: file://${{ github.workspace }}/language-sdk
104104
run: |
105-
pip install hatch==1.15.0
105+
pip install hatch==1.16.5
106106
python -m pip install -e .
107107
108108
- name: Get integration examples

.github/workflows/notify_slack.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Slack Notifications
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
pull_request_target:
7+
types: [opened, reopened]
8+
9+
permissions: {}
10+
11+
jobs:
12+
notify:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Send issue notification to Slack
16+
if: github.event_name == 'issues'
17+
uses: slackapi/slack-github-action@v2.1.1
18+
with:
19+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_ISSUE }}
20+
webhook-type: incoming-webhook
21+
payload: |
22+
{
23+
"action": "${{ github.event.action }}",
24+
"issue_url": "${{ github.event.issue.html_url }}",
25+
"package_name": "${{ github.repository }}"
26+
}
27+
28+
- name: Send pull request notification to Slack
29+
if: github.event_name == 'pull_request_target'
30+
uses: slackapi/slack-github-action@v2.1.1
31+
with:
32+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }}
33+
webhook-type: incoming-webhook
34+
payload: |
35+
{
36+
"action": "${{ github.event.action }}",
37+
"pr_url": "${{ github.event.pull_request.html_url }}",
38+
"package_name": "${{ github.repository }}"
39+
}

.github/workflows/pypi-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
python-version: "3.11"
2828
- name: Install Hatch
2929
run: |
30-
python -m pip install --upgrade hatch==1.15.0
30+
python -m pip install --upgrade hatch==1.16.5
3131
- name: Build release distributions
3232
run: |
3333
# NOTE: put your own distribution build steps here.

.github/workflows/sync-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install Hatch
2929
run: |
30-
python -m pip install --upgrade hatch==1.15.0
30+
python -m pip install --upgrade hatch==1.16.5
3131
- name: Build distribution
3232
run: hatch build
3333
- name: configure aws credentials

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
6262

6363
[tool.ruff]
6464
line-length = 88
65+
target-version = "py311"
6566

6667
[tool.ruff.lint]
6768
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
6875

6976
[tool.ruff.lint.per-file-ignores]
7077
"tests/**" = [

src/aws_durable_execution_sdk_python/serdes.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,7 @@ def encode(self, obj: Any) -> EncodedValue:
316316
def decode(self, tag: TypeTag, value: Any) -> Any:
317317
match tag:
318318
case (
319-
TypeTag.NONE
320-
| TypeTag.STR
321-
| TypeTag.BOOL
322-
| TypeTag.INT
323-
| TypeTag.FLOAT
319+
TypeTag.NONE | TypeTag.STR | TypeTag.BOOL | TypeTag.INT | TypeTag.FLOAT
324320
):
325321
return self.primitive_codec.decode(tag, value)
326322
case TypeTag.BYTES:

tests/concurrency_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,9 +2833,9 @@ def task_func(ctx, item, idx, items):
28332833
# With tolerated_failure_count=1, executor stops when failure_count > 1 (at 2 failures)
28342834
# Executor terminates early rather than executing all 100 tasks
28352835
assert executed_count["value"] < 100
2836-
assert (
2837-
result.completion_reason == CompletionReason.FAILURE_TOLERANCE_EXCEEDED
2838-
), executed_count
2836+
assert result.completion_reason == CompletionReason.FAILURE_TOLERANCE_EXCEEDED, (
2837+
executed_count
2838+
)
28392839
assert sum(1 for item in result.all if item.status == BatchItemStatus.FAILED) == 2
28402840
assert (
28412841
sum(1 for item in result.all if item.status == BatchItemStatus.SUCCEEDED) < 98
@@ -2965,9 +2965,9 @@ def slow_branch():
29652965

29662966
# Slow branch may or may not have started (depends on thread scheduling)
29672967
# but it definitely should not have completed
2968-
assert (
2969-
operation_tracker.slow_completed.call_count == 0
2970-
), "Executor should return before slow branch completes"
2968+
assert operation_tracker.slow_completed.call_count == 0, (
2969+
"Executor should return before slow branch completes"
2970+
)
29712971

29722972
# Result should show MIN_SUCCESSFUL_REACHED
29732973
assert result.completion_reason == CompletionReason.MIN_SUCCESSFUL_REACHED
@@ -3019,9 +3019,9 @@ def slow_func():
30193019
result = executor.execute(execution_state, executor_context)
30203020

30213021
# Executor should have returned before slow branch completed
3022-
assert (
3023-
not slow_branch_mock.completed.called
3024-
), "Executor should return before slow branch completes"
3022+
assert not slow_branch_mock.completed.called, (
3023+
"Executor should return before slow branch completes"
3024+
)
30253025

30263026
# Result should show MIN_SUCCESSFUL_REACHED
30273027
assert result.completion_reason == CompletionReason.MIN_SUCCESSFUL_REACHED

tests/operation/wait_for_condition_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ def wait_strategy(state, attempt):
662662
context_logger=mock_logger,
663663
)
664664

665-
assert (
666-
captured_attempts[-1] == 2
667-
), "After first retry (checkpoint.attempt=1), current attempt should be 2"
665+
assert captured_attempts[-1] == 2, (
666+
"After first retry (checkpoint.attempt=1), current attempt should be 2"
667+
)
668668

669669
# Test 3: After second retry (checkpoint has attempt=2)
670670
operation = Operation(
@@ -684,9 +684,9 @@ def wait_strategy(state, attempt):
684684
context_logger=mock_logger,
685685
)
686686

687-
assert (
688-
captured_attempts[-1] == 3
689-
), "After second retry (checkpoint.attempt=2), current attempt should be 3"
687+
assert captured_attempts[-1] == 3, (
688+
"After second retry (checkpoint.attempt=2), current attempt should be 3"
689+
)
690690

691691
# Test 4: After third retry (checkpoint has attempt=3)
692692
operation = Operation(
@@ -706,9 +706,9 @@ def wait_strategy(state, attempt):
706706
context_logger=mock_logger,
707707
)
708708

709-
assert (
710-
captured_attempts[-1] == 4
711-
), "After third retry (checkpoint.attempt=3), current attempt should be 4"
709+
assert captured_attempts[-1] == 4, (
710+
"After third retry (checkpoint.attempt=3), current attempt should be 4"
711+
)
712712

713713
# Verify the complete sequence is monotonically increasing
714714
assert captured_attempts == [

tests/state_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ def test_checkpointed_result_is_timed_out_false_for_other_statuses():
608608
status=status,
609609
)
610610
result = CheckpointedResult.create_from_operation(operation)
611-
assert (
612-
result.is_timed_out() is False
613-
), f"is_timed_out should be False for status {status}"
611+
assert result.is_timed_out() is False, (
612+
f"is_timed_out should be False for status {status}"
613+
)
614614

615615

616616
def test_fetch_paginated_operations_with_marker():
@@ -2535,9 +2535,9 @@ def test_create_checkpoint_is_sync_false_returns_immediately():
25352535
elapsed_time = time.time() - start_time
25362536

25372537
# Verify it returns immediately (should be < 10ms, we allow 50ms for safety)
2538-
assert (
2539-
elapsed_time < 0.05
2540-
), f"Async checkpoint took {elapsed_time:.3f}s, expected < 0.05s"
2538+
assert elapsed_time < 0.05, (
2539+
f"Async checkpoint took {elapsed_time:.3f}s, expected < 0.05s"
2540+
)
25412541

25422542
# Verify operation was enqueued
25432543
assert state._checkpoint_queue.qsize() == 1
@@ -3115,9 +3115,9 @@ def background_processor():
31153115
# Verify all calls blocked for at least the delay time
31163116
for i in range(num_callers):
31173117
elapsed = end_times[i] - start_times[i]
3118-
assert (
3119-
elapsed >= 0.15
3120-
), f"Caller {i} expected blocking for at least 0.15s, got {elapsed}s"
3118+
assert elapsed >= 0.15, (
3119+
f"Caller {i} expected blocking for at least 0.15s, got {elapsed}s"
3120+
)
31213121

31223122

31233123
def test_create_checkpoint_sync_with_empty_checkpoint():

0 commit comments

Comments
 (0)