From 332b7de9d8dd32d02162bcefcaf6ac94b663a20a Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 17 Nov 2025 15:11:20 +0000 Subject: [PATCH 01/11] chore: update supported python version --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 639274c..290834b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,17 @@ name = "aws-durable-execution-sdk-python" dynamic = ["version"] description = 'This the Python SDK for AWS Lambda Durable Functions.' readme = "README.md" -requires-python = ">=3.13" +requires-python = ">=3.11" license = "Apache-2.0" keywords = [] authors = [{ name = "yaythomas", email = "tgaigher@amazon.com" }] classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] From ece9ff6f1d60b22c105ea5f35a466e2c934f89bc Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 17 Nov 2025 15:13:32 +0000 Subject: [PATCH 02/11] chore: update supported python version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6f9f12..bd76556 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.13"] + python-version: ["3.11","3.12","3.13","3.14"] steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 From e38d44d570062703eed66224d780af4801aefcf4 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 17 Nov 2025 15:24:21 +0000 Subject: [PATCH 03/11] refactor: add conditional to check python version --- .../lambda_service.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index d73ecda..b8cfa62 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -3,10 +3,11 @@ import datetime import logging import os +import sys from dataclasses import dataclass, field from enum import Enum from pathlib import Path -from typing import TYPE_CHECKING, Any, Protocol, TypeAlias +from typing import TYPE_CHECKING, Any, Protocol import boto3 # type: ignore from botocore.config import Config # type: ignore @@ -19,12 +20,19 @@ if TYPE_CHECKING: from collections.abc import MutableMapping + from typing import TypeAlias from aws_durable_execution_sdk_python.identifier import OperationIdentifier -ReplayChildren: TypeAlias = bool # noqa UP040 ignore due to python3.11 minimum version -OperationPayload: TypeAlias = str # noqa UP040 ignore due to python3.11 minimum version -TimeoutSeconds: TypeAlias = int # noqa UP040 ignore due to python3.11 minimum version +# Remove it when dropping support to Python 3.11 +if sys.version_info >= (3, 12): + type ReplayChildren = bool + type OperationPayload = str + type TimeoutSeconds = int +else: + ReplayChildren: TypeAlias = bool + OperationPayload: TypeAlias = str + TimeoutSeconds: TypeAlias = int logger = logging.getLogger(__name__) From 310bf763adaedba0527dbec4724ff1581c806109 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 17 Nov 2025 15:35:05 +0000 Subject: [PATCH 04/11] refactor: add conditional to check python version --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd76556..fb08904 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: - name: Install Hatch run: | python -m pip install --upgrade hatch + python --version - name: static analysis run: hatch fmt --check - name: type checking From d30a5cdf622406216610db13918f771fb06f66f1 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 17 Nov 2025 16:18:12 +0000 Subject: [PATCH 05/11] refactor: add conditional to check python version --- src/aws_durable_execution_sdk_python/lambda_service.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index b8cfa62..4c513c3 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -7,7 +7,7 @@ from dataclasses import dataclass, field from enum import Enum from pathlib import Path -from typing import TYPE_CHECKING, Any, Protocol +from typing import TYPE_CHECKING, Any, Protocol, TypeAlias import boto3 # type: ignore from botocore.config import Config # type: ignore @@ -20,11 +20,10 @@ if TYPE_CHECKING: from collections.abc import MutableMapping - from typing import TypeAlias from aws_durable_execution_sdk_python.identifier import OperationIdentifier -# Remove it when dropping support to Python 3.11 +# Replace with `type` it when dropping support to Python 3.11 if sys.version_info >= (3, 12): type ReplayChildren = bool type OperationPayload = str From 4ae8614a07641d7c6a14bca2ae1e803c14502b4c Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 14:20:44 -0800 Subject: [PATCH 06/11] chore: remove unnecessary install types --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 290834b..5d08ede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aw [tool.hatch.envs.types] extra-dependencies = ["mypy>=1.0.0", "pytest"] [tool.hatch.envs.types.scripts] -check = "mypy --install-types --non-interactive {args:src/aws_durable_execution_sdk_python tests}" +check = "mypy --non-interactive {args:src/aws_durable_execution_sdk_python tests}" [tool.coverage.run] source_pkgs = ["aws_durable_execution_sdk_python"] From 7fdf3c4af184bb48b56257b98cebb1ca927450a6 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 14:22:35 -0800 Subject: [PATCH 07/11] chore: remove unnecessary install types --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5d08ede..1b0d9be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aw [tool.hatch.envs.types] extra-dependencies = ["mypy>=1.0.0", "pytest"] [tool.hatch.envs.types.scripts] -check = "mypy --non-interactive {args:src/aws_durable_execution_sdk_python tests}" +check = "mypy --pretty {args:src/aws_durable_execution_sdk_python tests}" [tool.coverage.run] source_pkgs = ["aws_durable_execution_sdk_python"] From 13d1e18aa658a25c29be8ce6bb62a747d75892f2 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 14:29:55 -0800 Subject: [PATCH 08/11] chore: remove unnecessary install types --- pyproject.toml | 2 +- .../lambda_service.py | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1b0d9be..290834b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aw [tool.hatch.envs.types] extra-dependencies = ["mypy>=1.0.0", "pytest"] [tool.hatch.envs.types.scripts] -check = "mypy --pretty {args:src/aws_durable_execution_sdk_python tests}" +check = "mypy --install-types --non-interactive {args:src/aws_durable_execution_sdk_python tests}" [tool.coverage.run] source_pkgs = ["aws_durable_execution_sdk_python"] diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index 4c513c3..145a99f 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -3,11 +3,10 @@ import datetime import logging import os -import sys from dataclasses import dataclass, field from enum import Enum from pathlib import Path -from typing import TYPE_CHECKING, Any, Protocol, TypeAlias +from typing import TYPE_CHECKING, Any, Protocol import boto3 # type: ignore from botocore.config import Config # type: ignore @@ -23,16 +22,11 @@ from aws_durable_execution_sdk_python.identifier import OperationIdentifier +# Keep it simple without TypeAlias # Replace with `type` it when dropping support to Python 3.11 -if sys.version_info >= (3, 12): - type ReplayChildren = bool - type OperationPayload = str - type TimeoutSeconds = int -else: - ReplayChildren: TypeAlias = bool - OperationPayload: TypeAlias = str - TimeoutSeconds: TypeAlias = int - +ReplayChildren = bool +OperationPayload = str +TimeoutSeconds = int logger = logging.getLogger(__name__) From 84e1fd7b898d7f8cb6b58037a33720546d9cc57a Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 14:43:04 -0800 Subject: [PATCH 09/11] chore: remove unnecessary install types --- src/aws_durable_execution_sdk_python/lambda_service.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index 145a99f..ffb9323 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -6,7 +6,7 @@ from dataclasses import dataclass, field from enum import Enum from pathlib import Path -from typing import TYPE_CHECKING, Any, Protocol +from typing import TYPE_CHECKING, Any, Protocol, TypeAlias import boto3 # type: ignore from botocore.config import Config # type: ignore @@ -22,11 +22,10 @@ from aws_durable_execution_sdk_python.identifier import OperationIdentifier -# Keep it simple without TypeAlias # Replace with `type` it when dropping support to Python 3.11 -ReplayChildren = bool -OperationPayload = str -TimeoutSeconds = int +ReplayChildren: TypeAlias = bool +OperationPayload: TypeAlias = str +TimeoutSeconds: TypeAlias = int logger = logging.getLogger(__name__) From 3b87359b6735652e3f0a97a89f0b78734e98e7f6 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 15:11:16 -0800 Subject: [PATCH 10/11] refactor: make it compatible with Python 3.11 --- src/aws_durable_execution_sdk_python/serdes.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/aws_durable_execution_sdk_python/serdes.py b/src/aws_durable_execution_sdk_python/serdes.py index 24a0fae..d589629 100644 --- a/src/aws_durable_execution_sdk_python/serdes.py +++ b/src/aws_durable_execution_sdk_python/serdes.py @@ -415,10 +415,14 @@ def deserialize(self, data: str, context: SerDesContext | None = None) -> Any: if not (isinstance(obj, dict) and TYPE_TOKEN in obj and VALUE_TOKEN in obj): msg = 'Malformed envelope: missing "t" or "v" at root.' raise SerDesError(msg) - if obj[TYPE_TOKEN] not in TypeTag: + # Python 3.11 compatibility: Using try-except instead of 'in' operator + # because checking 'str in EnumType' raises TypeError in Python 3.11 + try: + tag = TypeTag(obj[TYPE_TOKEN]) + except ValueError: msg = f'Unknown type tag: "{obj[TYPE_TOKEN]}"' - raise SerDesError(msg) - tag = TypeTag(obj[TYPE_TOKEN]) + raise SerDesError(msg) from None + return self._codec.decode(tag, obj[VALUE_TOKEN]) def _to_json_serializable(self, obj: Any) -> Any: From 90938c98404b45405f2f08ac3d92279ad496b177 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Mon, 24 Nov 2025 15:13:40 -0800 Subject: [PATCH 11/11] refactor: make it compatible with Python 3.11 --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb08904..bd76556 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,6 @@ jobs: - name: Install Hatch run: | python -m pip install --upgrade hatch - python --version - name: static analysis run: hatch fmt --check - name: type checking