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 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", ] diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index 8769eca..5afdb5d 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -22,10 +22,10 @@ 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 - +# Replace with `type` it when dropping support to Python 3.11 +ReplayChildren: TypeAlias = bool +OperationPayload: TypeAlias = str +TimeoutSeconds: TypeAlias = int logger = logging.getLogger(__name__) 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: