Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Oct 15, 2025

Replaces previous uses of LambdaContext with a dataclass that implements the proto from sdk repo.

Dependencies

If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.

PYTHON_LANGUAGE_SDK_BRANCH: lambda-ctx

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ghost ghost force-pushed the lambda-ctx branch from 9fccd47 to c8b1b85 Compare October 15, 2025 21:59
@ghost ghost marked this pull request as ready for review October 15, 2025 22:05
cognito_identity=cognito_identity_dict,
epoch_deadline_time_in_ms=int(
return {
"invoke_id": "test-invoke-12345",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per review here, https://github.com/aws/aws-durable-execution-sdk-python-testing/pull/54/files

this is a class, not a dict.

maybe make a lightweight dataclass here just for the Testing Lib that incorporate the protocol?

from sdk import LambdaContext as LambdaContextProtocol

@dataclass
class LambdaContext(LambdaContextProtocol):
    aws_request_id: str
    log_group_name: str | None = None
    log_stream_name: str | None = None
    function_name: str | None = None
    memory_limit_in_mb: str | None = None
    function_version: str | None = None
    invoked_function_arn: str | None = None
    tenant_id: str | None = None
    client_context: object | None = None
    identity: object | None = None

    def get_remaining_time_in_millis(self) -> int:
        return 0  # Implementation needed

    def log(self, msg: str) -> None:
        print(msg)  # Implementation needed

Copy link
Author

@ghost ghost Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: Clarified offline. Will use class instead.

@ghost ghost closed this Oct 16, 2025
@ghost ghost force-pushed the lambda-ctx branch from c8b1b85 to 72879ac Compare October 16, 2025 00:08
@ghost ghost reopened this Oct 16, 2025
@ghost ghost force-pushed the lambda-ctx branch from dc0db82 to 8473d04 Compare October 16, 2025 01:38
Signed-off-by: Astraea Sinclair <quinsclr@amazon.com>
@ghost ghost force-pushed the lambda-ctx branch from 8473d04 to 138c11d Compare October 16, 2025 13:48
@ghost ghost changed the title Replace LambdaContext class with a typed dictionary Replace LambdaContext class with a Proto and a dataclass Oct 16, 2025
@ghost ghost merged commit be4af22 into main Oct 16, 2025
14 checks passed
@wangyb-A wangyb-A deleted the lambda-ctx branch November 18, 2025 16:58
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants