Skip to content

Commit 90418eb

Browse files
committed
Include Support for python 3.10 and 3.11
1 parent 970e9c1 commit 90418eb

11 files changed

+44
-21
lines changed

.github/workflows/test-on-push-and-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
- name: Set up python
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: '3.8'
20+
python-version: '3.11'
2121
- name: Run 'pr' target
2222
run: make pr

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ setup-codebuild-agent:
1717

1818
.PHONY: test-smoke
1919
test-smoke: setup-codebuild-agent
20-
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh tests/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 3.9
20+
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh tests/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 3.11
2121

2222
.PHONY: test-integ
2323
test-integ: setup-codebuild-agent

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ We have open-sourced a set of software packages, Runtime Interface Clients (RIC)
55
base images to be Lambda compatible.
66
The Lambda Runtime Interface Client is a lightweight interface that allows your runtime to receive requests from and send requests to the Lambda service.
77

8-
The Lambda Python Runtime Interface Client is vended through [pip](https://pypi.org/project/awslambdaric).
8+
The Lambda Python Runtime Interface Client is vended through [pip](https://pypi.org/project/awslambdaric).
99
You can include this package in your preferred base image to make that base image Lambda compatible.
1010

1111
## Requirements
1212
The Python Runtime Interface Client package currently supports Python versions:
13-
- 3.7.x up to and including 3.9.x
13+
- 3.7.x up to and including 3.11.x
1414

1515
## Usage
1616

@@ -104,18 +104,18 @@ def handler(event, context):
104104

105105
### Local Testing
106106

107-
To make it easy to locally test Lambda functions packaged as container images we open-sourced a lightweight web-server, Lambda Runtime Interface Emulator (RIE), which allows your function packaged as a container image to accept HTTP requests. You can install the [AWS Lambda Runtime Interface Emulator](https://github.com/aws/aws-lambda-runtime-interface-emulator) on your local machine to test your function. Then when you run the image function, you set the entrypoint to be the emulator.
107+
To make it easy to locally test Lambda functions packaged as container images we open-sourced a lightweight web-server, Lambda Runtime Interface Emulator (RIE), which allows your function packaged as a container image to accept HTTP requests. You can install the [AWS Lambda Runtime Interface Emulator](https://github.com/aws/aws-lambda-runtime-interface-emulator) on your local machine to test your function. Then when you run the image function, you set the entrypoint to be the emulator.
108108

109109
*To install the emulator and test your Lambda function*
110110

111-
1) From your project directory, run the following command to download the RIE from GitHub and install it on your local machine.
111+
1) From your project directory, run the following command to download the RIE from GitHub and install it on your local machine.
112112

113113
```shell script
114114
mkdir -p ~/.aws-lambda-rie && \
115115
curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
116116
chmod +x ~/.aws-lambda-rie/aws-lambda-rie
117117
```
118-
2) Run your Lambda image function using the docker run command.
118+
2) Run your Lambda image function using the docker run command.
119119

120120
```shell script
121121
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
@@ -124,9 +124,9 @@ docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
124124
/usr/local/bin/python -m awslambdaric app.handler
125125
```
126126

127-
This runs the image as a container and starts up an endpoint locally at `http://localhost:9000/2015-03-31/functions/function/invocations`.
127+
This runs the image as a container and starts up an endpoint locally at `http://localhost:9000/2015-03-31/functions/function/invocations`.
128128

129-
3) Post an event to the following endpoint using a curl command:
129+
3) Post an event to the following endpoint using a curl command:
130130

131131
```shell script
132132
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
@@ -175,4 +175,4 @@ If you discover a potential security issue in this project we ask that you notif
175175

176176
## License
177177

178-
This project is licensed under the Apache-2.0 License.
178+
This project is licensed under the Apache-2.0 License.

setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import os
77
import platform
88
from subprocess import check_call, check_output
9+
910
from setuptools import Extension, find_packages, setup
11+
1012
from awslambdaric import __version__
1113

1214

@@ -88,6 +90,8 @@ def read_requirements(req="base.txt"):
8890
"Programming Language :: Python :: 3.7",
8991
"Programming Language :: Python :: 3.8",
9092
"Programming Language :: Python :: 3.9",
93+
"Programming Language :: Python :: 3.10",
94+
"Programming Language :: Python :: 3.11",
9195
"License :: OSI Approved :: Apache Software License",
9296
"Operating System :: OS Independent",
9397
],

tests/integration/codebuild/buildspec.os.alpine.yml

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ batch:
2222
- "3.7"
2323
- "3.8"
2424
- "3.9"
25+
- "3.10"
26+
- "3.11"
2527
phases:
2628
pre_build:
2729
commands:

tests/integration/codebuild/buildspec.os.amazonlinux.1.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ batch:
2020
- "3.7"
2121
- "3.8"
2222
- "3.9"
23+
- "3.10"
24+
- "3.11"
2325
phases:
2426
pre_build:
2527
commands:
@@ -98,4 +100,4 @@ phases:
98100
- docker rm --force "${TEST_NAME}-app" || true
99101
- docker stop "${TEST_NAME}-tester" || true
100102
- docker rm --force "${TEST_NAME}-tester" || true
101-
- docker network rm "${TEST_NAME}-network" || true
103+
- docker network rm "${TEST_NAME}-network" || true

tests/integration/codebuild/buildspec.os.amazonlinux.2.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ batch:
2020
- "3.7"
2121
- "3.8"
2222
- "3.9"
23+
- "3.10"
24+
- "3.11"
2325
phases:
2426
pre_build:
2527
commands:
@@ -107,4 +109,4 @@ phases:
107109
- docker rm --force "${TEST_NAME}-app" || true
108110
- docker stop "${TEST_NAME}-tester" || true
109111
- docker rm --force "${TEST_NAME}-tester" || true
110-
- docker network rm "${TEST_NAME}-network" || true
112+
- docker network rm "${TEST_NAME}-network" || true

tests/integration/codebuild/buildspec.os.centos.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ batch:
2020
- "3.7"
2121
- "3.8"
2222
- "3.9"
23+
- "3.10"
24+
- "3.11"
2325
phases:
2426
pre_build:
2527
commands:
@@ -107,4 +109,4 @@ phases:
107109
- docker rm --force "${TEST_NAME}-app" || true
108110
- docker stop "${TEST_NAME}-tester" || true
109111
- docker rm --force "${TEST_NAME}-tester" || true
110-
- docker network rm "${TEST_NAME}-network" || true
112+
- docker network rm "${TEST_NAME}-network" || true

tests/integration/codebuild/buildspec.os.debian.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ batch:
2121
- "3.7"
2222
- "3.8"
2323
- "3.9"
24+
- "3.10"
25+
- "3.11"
2426
phases:
2527
pre_build:
2628
commands:
@@ -110,4 +112,4 @@ phases:
110112
- docker rm --force "${TEST_NAME}-app" || true
111113
- docker stop "${TEST_NAME}-tester" || true
112114
- docker rm --force "${TEST_NAME}-tester" || true
113-
- docker network rm "${TEST_NAME}-network" || true
115+
- docker network rm "${TEST_NAME}-network" || true

tests/integration/codebuild/buildspec.os.ubuntu.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ batch:
2121
- "3.7"
2222
- "3.8"
2323
- "3.9"
24+
- "3.10"
25+
- "3.11"
2426
phases:
2527
pre_build:
2628
commands:
@@ -108,4 +110,4 @@ phases:
108110
- docker rm --force "${TEST_NAME}-app" || true
109111
- docker stop "${TEST_NAME}-tester" || true
110112
- docker rm --force "${TEST_NAME}-tester" || true
111-
- docker network rm "${TEST_NAME}-network" || true
113+
- docker network rm "${TEST_NAME}-network" || true

tests/test_bootstrap.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,10 @@ def raise_exception_handler(json_input, lambda_context):
585585

586586
self.assertEqual(mock_stdout.getvalue(), error_logs)
587587

588-
@patch("sys.stdout", new_callable=StringIO)
589588
@patch("importlib.import_module")
589+
@patch("sys.stdout", new_callable=StringIO)
590590
def test_handle_event_request_fault_exception_logging_syntax_error(
591-
self, mock_import_module, mock_stdout
591+
self, mock_stdout, mock_import_module
592592
):
593593
try:
594594
eval("-")
@@ -616,10 +616,17 @@ def test_handle_event_request_fault_exception_logging_syntax_error(
616616

617617
sys.stderr.write(mock_stdout.getvalue())
618618

619-
error_logs = (
620-
"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': "
621-
"unexpected EOF while parsing (<string>, line 1)\r"
622-
)
619+
if sys.version_info < (3, 10):
620+
error_logs = (
621+
"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': "
622+
"unexpected EOF while parsing (<string>, line 1)\r"
623+
)
624+
else:
625+
error_logs = (
626+
"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': "
627+
"invalid syntax (<string>, line 1)\r"
628+
)
629+
623630
error_logs += "Traceback (most recent call last):\r"
624631
error_logs += '  File "<string>" Line 1\r'
625632
error_logs += "    -\n"

0 commit comments

Comments
 (0)