Skip to content

Commit 0098b36

Browse files
stokitolakkeger
andauthored
Upgrade to Python 3.11 (#22)
Co-authored-by: Gábor Németh <gabor.jozsef.nemeth@localstack.cloud>
1 parent f23ba86 commit 0098b36

File tree

7 files changed

+28
-25
lines changed

7 files changed

+28
-25
lines changed

.github/workflows/cloudpod_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v2
2525

26-
- name: Set up Python 3.9
26+
- name: Set up Python 3.11
2727
id: setup-python
2828
uses: actions/setup-python@v2
2929
with:
30-
python-version: 3.9
30+
python-version: 3.11
3131

3232
- name: Set up Project
3333
run: |

.github/workflows/integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
- name: Checkout
3030
uses: actions/checkout@v2
3131

32-
- name: Set up Python 3.9
32+
- name: Set up Python 3.11
3333
id: setup-python
3434
uses: actions/setup-python@v2
3535
with:
36-
python-version: 3.9
36+
python-version: 3.11
3737

3838
- name: Docker setup (macos only)
3939
id: setup-docker-mac

.github/workflows/preview_create.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
- name: Checkout
1515
uses: actions/checkout@v4
1616

17-
- name: Set up Python 3.9
17+
- name: Set up Python 3.11
1818
id: setup-python
1919
uses: actions/setup-python@v2
2020
with:
21-
python-version: 3.9
21+
python-version: 3.11
2222

2323
- name: Install dependencies
2424
run: |

.github/workflows/test_cloudpods.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup Python
5252
uses: actions/setup-python@v4
5353
with:
54-
python-version: '3.9'
54+
python-version: '3.11'
5555

5656
- name: Start LocalStack
5757
uses: LocalStack/setup-localstack@main

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ The GitHub workflow runs a set of integration tests using pytest.
4646
### Dev environment
4747

4848
Make sure you use the same version as the Python Lambdas to make Pillow work.
49-
If you use pyenv, then first install and activate Python 3.9:
49+
If you use pyenv, then first install and activate Python 3.11:
5050

5151
```bash
52-
pyenv install 3.9.16
53-
pyenv global 3.9.16
52+
pyenv install 3.11.6
53+
pyenv global 3.11.6
5454
```
5555

5656
```console
5757
% python --version
58-
Python 3.9.16
58+
Python 3.11.6
5959
```
6060

6161
Create a virtualenv and install all the development dependencies there:
@@ -77,7 +77,7 @@ LOCALSTACK_API_KEY=... localstack start
7777
## Instructions
7878

7979
You can create the AWS infrastructure on LocalStack by running `bin/deploy.sh`.
80-
Make sure you have Python 3.9 activated before running the script.
80+
Make sure you have Python 3.11 activated before running the script.
8181

8282
Here are instructions to deploy it manually step-by-step.
8383

@@ -122,7 +122,7 @@ This Lambda is responsible for generating pre-signed POST URLs to upload files t
122122
(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py)
123123
awslocal lambda create-function \
124124
--function-name presign \
125-
--runtime python3.9 \
125+
--runtime python3.11 \
126126
--timeout 10 \
127127
--zip-file fileb://lambdas/presign/lambda.zip \
128128
--handler handler.handler \
@@ -150,7 +150,7 @@ awslocal lambda create-function \
150150
--function-name list \
151151
--handler handler.handler \
152152
--zip-file fileb://lambdas/list/lambda.zip \
153-
--runtime python3.9 \
153+
--runtime python3.11 \
154154
--role arn:aws:iam::000000000000:role/lambda-role \
155155
--environment Variables="{STAGE=local}"
156156
```
@@ -177,7 +177,7 @@ awslocal lambda create-function-url-config \
177177
)
178178
awslocal lambda create-function \
179179
--function-name resize \
180-
--runtime python3.9 \
180+
--runtime python3.11 \
181181
--timeout 10 \
182182
--zip-file fileb://lambdas/resize/lambda.zip \
183183
--handler handler.handler \

bin/deploy.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ awslocal sns subscribe \
1717
(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py)
1818
awslocal lambda create-function \
1919
--function-name presign \
20-
--runtime python3.9 \
20+
--runtime python3.11 \
2121
--timeout 10 \
2222
--zip-file fileb://lambdas/presign/lambda.zip \
2323
--handler handler.handler \
@@ -33,7 +33,7 @@ awslocal lambda create-function-url-config \
3333
(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py)
3434
awslocal lambda create-function \
3535
--function-name list \
36-
--runtime python3.9 \
36+
--runtime python3.11 \
3737
--timeout 10 \
3838
--zip-file fileb://lambdas/list/lambda.zip \
3939
--handler handler.handler \
@@ -51,7 +51,8 @@ if [ "$os" == "Darwin" ]; then
5151
(
5252
cd lambdas/resize
5353
rm -rf libs lambda.zip
54-
docker run --platform linux/x86_64 --rm -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.9" /bin/sh -c "pip install -r requirements.txt -t libs; exit"
54+
docker run --platform linux/x86_64 --rm -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.11" /bin/sh -c "pip install -r requirements.txt -t libs; exit"
55+
5556
cd libs && zip -r ../lambda.zip . && cd ..
5657
zip lambda.zip handler.py
5758
rm -rf libs
@@ -70,7 +71,7 @@ fi
7071

7172
awslocal lambda create-function \
7273
--function-name resize \
73-
--runtime python3.9 \
74+
--runtime python3.11 \
7475
--timeout 10 \
7576
--zip-file fileb://lambdas/resize/lambda.zip \
7677
--handler handler.handler \
@@ -81,9 +82,10 @@ awslocal lambda create-function \
8182
awslocal lambda wait function-active-v2 --function-name resize
8283
awslocal lambda put-function-event-invoke-config --function-name resize --maximum-event-age-in-seconds 3600 --maximum-retry-attempts 0
8384

85+
fn_resize_arn=$(awslocal lambda get-function --function-name resize | jq -r .Configuration.FunctionArn)
8486
awslocal s3api put-bucket-notification-configuration \
8587
--bucket localstack-thumbnails-app-images \
86-
--notification-configuration "{\"LambdaFunctionConfigurations\": [{\"LambdaFunctionArn\": \"$(awslocal lambda get-function --function-name resize | jq -r .Configuration.FunctionArn)\", \"Events\": [\"s3:ObjectCreated:*\"]}]}"
88+
--notification-configuration "{\"LambdaFunctionConfigurations\": [{\"LambdaFunctionArn\": \"$fn_resize_arn\", \"Events\": [\"s3:ObjectCreated:*\"]}]}"
8789

8890
awslocal s3 mb s3://webapp
8991
awslocal s3 sync --delete ./website s3://webapp
@@ -95,4 +97,5 @@ awslocal lambda list-function-url-configs --function-name presign | jq -r '.Func
9597
echo "Fetching function URL for 'list' Lambda..."
9698
awslocal lambda list-function-url-configs --function-name list | jq -r '.FunctionUrlConfigs[0].FunctionUrl'
9799

98-
echo "Now open the Web app under https://webapp.s3-website.localhost.localstack.cloud:4566 and paste the function URLs above (make sure to use https:// as protocol)"
100+
echo "Now open the Web app under https://webapp.s3-website.localhost.localstack.cloud:4566/"
101+
echo "and paste the function URLs above (make sure to use https:// as protocol)"

requirements-dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
boto3
22
requests>=2.20
33
Pillow==9.2.0
4-
mypy_boto3_ssm
5-
mypy_boto3_sns
6-
mypy_boto3_s3
7-
mypy_boto3_lambda
4+
mypy-boto3-ssm
5+
mypy-boto3-sns
6+
mypy-boto3-s3
7+
mypy-boto3-lambda
88
black
99
pytest
1010
awscli

0 commit comments

Comments
 (0)