Skip to content

Python 3.13 support #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/python/black
rev: 19.3b0
rev: 24.10.0
hooks:
- id: black
language_version: python3.6
language_version: python3.9
exclude_types: ['markdown', 'ini', 'toml', 'rst']
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.9.x up to and including 3.13.x

## Usage

7 changes: 4 additions & 3 deletions awslambdaric/bootstrap.py
Original file line number Diff line number Diff line change
@@ -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(
5 changes: 4 additions & 1 deletion awslambdaric/lambda_runtime_marshaller.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ pytest-cov>=2.4.0
pylint>=1.7.2
black>=20.8b0
bandit>=1.6.2
setuptools

# Test requirements
pytest>=3.0.7
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -84,17 +84,15 @@ def read_requirements(req="base.txt"):
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"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",
],
python_requires=">=3.6",
python_requires=">=3.9",
ext_modules=get_runtime_client_extension(),
test_suite="tests",
)
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.alpine.yml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.amazonlinux.2.yml
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.debian.yml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
1 change: 1 addition & 0 deletions tests/integration/codebuild/buildspec.os.ubuntu.yml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ batch:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
phases:
pre_build:
commands:
6 changes: 5 additions & 1 deletion tests/test_lambda_runtime_marshaller.py
Original file line number Diff line number Diff line change
@@ -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)