From a01524f848d20146567fb9352fca58b8741ff3f2 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 09:22:10 +0100 Subject: [PATCH 1/7] Remove support for Python 3.6 --- .pre-commit-config.yaml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dcabbf4..bfef1fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,5 +3,5 @@ repos: rev: 19.3b0 hooks: - id: black - language_version: python3.6 + language_version: python3.7 exclude_types: ['markdown', 'ini', 'toml', 'rst'] diff --git a/setup.py b/setup.py index 2544b21..d8df6d9 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,6 @@ 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", @@ -94,7 +93,7 @@ def read_requirements(req="base.txt"): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - python_requires=">=3.6", + python_requires=">=3.7", ext_modules=get_runtime_client_extension(), test_suite="tests", ) From 3cebd0f118c7de3b4e9a687b419d736194ffe98f Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 09:23:00 +0100 Subject: [PATCH 2/7] Remove support for Python 3.7 --- .pre-commit-config.yaml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfef1fe..582378a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,5 +3,5 @@ repos: rev: 19.3b0 hooks: - id: black - language_version: python3.7 + language_version: python3.8 exclude_types: ['markdown', 'ini', 'toml', 'rst'] diff --git a/setup.py b/setup.py index d8df6d9..9b4cb74 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,6 @@ def read_requirements(req="base.txt"): "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -93,7 +92,7 @@ def read_requirements(req="base.txt"): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - python_requires=">=3.7", + python_requires=">=3.8", ext_modules=get_runtime_client_extension(), test_suite="tests", ) From 92cf1a3e20a8a2fad77006e060b57af3b097d4a0 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 09:23:26 +0100 Subject: [PATCH 3/7] Remove support for Python 3.8 --- .pre-commit-config.yaml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 582378a..bb66b03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,5 +3,5 @@ repos: rev: 19.3b0 hooks: - id: black - language_version: python3.8 + language_version: python3.9 exclude_types: ['markdown', 'ini', 'toml', 'rst'] diff --git a/setup.py b/setup.py index 9b4cb74..3a63053 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,6 @@ def read_requirements(req="base.txt"): "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -92,7 +91,7 @@ def read_requirements(req="base.txt"): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], - python_requires=">=3.8", + python_requires=">=3.9", ext_modules=get_runtime_client_extension(), test_suite="tests", ) From 655dca6c764cce20e7465bc92fe9ff824778759c Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 09:55:12 +0100 Subject: [PATCH 4/7] Added support for Python 3.13 --- awslambdaric/bootstrap.py | 7 ++++--- awslambdaric/lambda_runtime_marshaller.py | 5 ++++- setup.py | 1 + tests/integration/codebuild/buildspec.os.alpine.yml | 1 + tests/integration/codebuild/buildspec.os.amazonlinux.2.yml | 1 + tests/integration/codebuild/buildspec.os.debian.yml | 1 + tests/integration/codebuild/buildspec.os.ubuntu.yml | 1 + tests/test_lambda_runtime_marshaller.py | 6 +++++- 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/awslambdaric/bootstrap.py b/awslambdaric/bootstrap.py index 0f19f56..88353a5 100644 --- a/awslambdaric/bootstrap.py +++ b/awslambdaric/bootstrap.py @@ -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( diff --git a/awslambdaric/lambda_runtime_marshaller.py b/awslambdaric/lambda_runtime_marshaller.py index 3b28313..4256066 100644 --- a/awslambdaric/lambda_runtime_marshaller.py +++ b/awslambdaric/lambda_runtime_marshaller.py @@ -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) diff --git a/setup.py b/setup.py index 3a63053..2bf28ef 100644 --- a/setup.py +++ b/setup.py @@ -88,6 +88,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", ], diff --git a/tests/integration/codebuild/buildspec.os.alpine.yml b/tests/integration/codebuild/buildspec.os.alpine.yml index f3c53e1..8b290f5 100644 --- a/tests/integration/codebuild/buildspec.os.alpine.yml +++ b/tests/integration/codebuild/buildspec.os.alpine.yml @@ -22,6 +22,7 @@ batch: - "3.10" - "3.11" - "3.12" + - "3.13" phases: pre_build: commands: diff --git a/tests/integration/codebuild/buildspec.os.amazonlinux.2.yml b/tests/integration/codebuild/buildspec.os.amazonlinux.2.yml index f8b7126..b7577c4 100644 --- a/tests/integration/codebuild/buildspec.os.amazonlinux.2.yml +++ b/tests/integration/codebuild/buildspec.os.amazonlinux.2.yml @@ -21,6 +21,7 @@ batch: - "3.10" - "3.11" - "3.12" + - "3.13" phases: pre_build: commands: diff --git a/tests/integration/codebuild/buildspec.os.debian.yml b/tests/integration/codebuild/buildspec.os.debian.yml index 008e6e8..44c061f 100644 --- a/tests/integration/codebuild/buildspec.os.debian.yml +++ b/tests/integration/codebuild/buildspec.os.debian.yml @@ -22,6 +22,7 @@ batch: - "3.10" - "3.11" - "3.12" + - "3.13" phases: pre_build: commands: diff --git a/tests/integration/codebuild/buildspec.os.ubuntu.yml b/tests/integration/codebuild/buildspec.os.ubuntu.yml index ac7c6db..a6e556d 100644 --- a/tests/integration/codebuild/buildspec.os.ubuntu.yml +++ b/tests/integration/codebuild/buildspec.os.ubuntu.yml @@ -22,6 +22,7 @@ batch: - "3.10" - "3.11" - "3.12" + - "3.13" phases: pre_build: commands: diff --git a/tests/test_lambda_runtime_marshaller.py b/tests/test_lambda_runtime_marshaller.py index 7cd73b4..843bcee 100644 --- a/tests/test_lambda_runtime_marshaller.py +++ b/tests/test_lambda_runtime_marshaller.py @@ -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) From 86927bfb3454b8e98e4291c813dfdb756f0a2b66 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 09:55:19 +0100 Subject: [PATCH 5/7] Updated Black pre-commit hook to the latest available version The previous version no longer works due to breaking changes made to some of the dependencies of Black. --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb66b03..8bb1315 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/python/black - rev: 19.3b0 + rev: 24.10.0 hooks: - id: black language_version: python3.9 From 3207f44a938daedce5d2d9f2581e0043f88da02b Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Thu, 10 Oct 2024 10:25:57 +0100 Subject: [PATCH 6/7] Add setuptools as a dev dependency It is necessary for building the package when running the integration tests, but more recent Python versions no longer include it by default: https://github.com/python/cpython/pull/101039. --- requirements/dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/dev.txt b/requirements/dev.txt index 68377ce..73d8f15 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -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 From 18272dbc81a97ff758440222d4893ce7a4d12ea8 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Tue, 15 Oct 2024 21:44:39 +0100 Subject: [PATCH 7/7] Update supported Python version range mentioned in README file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a448bd..c3cba04 100644 --- a/README.md +++ b/README.md @@ -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