Skip to content

Commit

Permalink
Add python3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
briensea committed Oct 10, 2024
1 parent 2fe3eca commit a762c33
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can include this package in your preferred base image to make that base imag

## Requirements
The Python Runtime Interface Client package currently supports Python versions:
- 3.7.x up to and including 3.12.x
- 3.7.x up to and including 3.13.x

## Usage

Expand Down
7 changes: 4 additions & 3 deletions awslambdaric/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,10 @@ def run(app_root, handler, lambda_runtime_api_addr):
sys.stdout = Unbuffered(sys.stdout)
sys.stderr = Unbuffered(sys.stderr)

use_thread_for_polling_next = (
os.environ.get("AWS_EXECUTION_ENV") == "AWS_Lambda_python3.12"
)
use_thread_for_polling_next = os.environ.get("AWS_EXECUTION_ENV") in [
"AWS_Lambda_python3.12",
"AWS_Lambda_python3.13",
]

with create_log_sink() as log_sink:
lambda_runtime_client = LambdaRuntimeClient(
Expand Down
5 changes: 4 additions & 1 deletion awslambdaric/lambda_runtime_marshaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# We also set 'ensure_ascii=False' so that the encoded json contains unicode characters instead of unicode escape sequences
class Encoder(json.JSONEncoder):
def __init__(self):
if os.environ.get("AWS_EXECUTION_ENV") == "AWS_Lambda_python3.12":
if os.environ.get("AWS_EXECUTION_ENV") in {
"AWS_Lambda_python3.12",
"AWS_Lambda_python3.13",
}:
super().__init__(use_decimal=False, ensure_ascii=False, allow_nan=True)
else:
super().__init__(use_decimal=False, allow_nan=True)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def read_requirements(req="base.txt"):
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
Expand Down
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.amazonlinux.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
Expand Down
6 changes: 5 additions & 1 deletion tests/test_lambda_runtime_marshaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

class TestLambdaRuntimeMarshaller(unittest.TestCase):
execution_envs = (
"AWS_Lambda_python3.13",
"AWS_Lambda_python3.12",
"AWS_Lambda_python3.11",
"AWS_Lambda_python3.10",
"AWS_Lambda_python3.9",
)

envs_lambda_marshaller_ensure_ascii_false = {"AWS_Lambda_python3.12"}
envs_lambda_marshaller_ensure_ascii_false = {
"AWS_Lambda_python3.12",
"AWS_Lambda_python3.13",
}

execution_envs_lambda_marshaller_ensure_ascii_true = tuple(
set(execution_envs).difference(envs_lambda_marshaller_ensure_ascii_false)
Expand Down

0 comments on commit a762c33

Please sign in to comment.