Skip to content

Update to Python 3.12 #10235

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ version: 2.1
parameters:
ubuntu-amd64-machine-image:
type: string
default: "ubuntu-2204:2023.02.1"
default: "ubuntu-2404:2024.08.1"
ubuntu-arm64-machine-image:
type: string
default: "ubuntu-2204:2023.02.1"
default: "ubuntu-2404:2024.08.1"
PYTEST_LOGLEVEL:
type: string
default: "WARNING"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/asf-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
sudo apt-get update
sudo apt-get install jq

- name: Set up Python 3.11
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Install release helper dependencies
run: pip install --upgrade setuptools setuptools_scm
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/marker-report-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Open marker report GH issue
on:
# only manual for now
workflow_dispatch:
inputs:
dryRun:
description: 'Execute a Dry-Run? A Dry-Run will not create any issues and only print the issue content in the logs instead'
required: false
type: boolean
default: false
updateExistingIssue:
description: 'Select the empty string "" to open duplicate issues, "true" to update duplicate issues and "false" to skip duplicate issues'
required: false
type: choice
default: ''
options:
- ''
- 'false'
- 'true'

jobs:
marker-report-issue:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:

- name: Checkout this repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: make install-dev

# makes use of the marker report plugin localstack.testing.pytest.marker_report
- name: Generate marker report
env:
PYTEST_ADDOPTS: "-p no:localstack.testing.pytest.fixtures -p no:localstack_snapshot.pytest.snapshot -p no:localstack.testing.pytest.filters -p no:localstack.testing.pytest.fixture_conflicts -p no:tests.fixtures -s --co --disable-warnings --marker-report --marker-report-path './target'"
MARKER_REPORT_PROJECT_NAME: localstack
MARKER_REPORT_COMMIT_SHA: ${{ github.sha }}
run: |
. ./.venv/bin/activate
pip install codeowners
python -m pytest tests/aws/
mv ./target/marker-report*.json ./target/marker-report.json

- name: Enrich and render marker report
env:
MARKER_REPORT_PATH: ./target/marker-report.json
CODEOWNERS_PATH: ./CODEOWNERS
TEMPLATE_PATH: ./.github/bot_templates/MARKER_REPORT_ISSUE.md.j2
OUTPUT_PATH: ./target/MARKER_REPORT_ISSUE.md
GITHUB_REPO: ${{ github.repository }}
COMMIT_SHA: ${{ github.sha }}
run: |
. ./.venv/bin/activate
pip install codeowners
python scripts/render_marker_report.py

- name: Print generated markdown
run: |
cat ./target/MARKER_REPORT_ISSUE.md

- name: Upload generated markdown
uses: actions/upload-artifact@v4
with:
path: ./target/MARKER_REPORT_ISSUE.md

- name: Create GH issue from template
if: inputs.dryRun != true
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
with:
# `update_existing` actually has 3 possible values:
# 1. not set => will always open duplicates
# 2. false => will not update and will not open duplicates (NOOP if title conflict detected)
# 3. true => will update an existing one if conflict detected
update_existing: ${{ inputs.updateExistingIssue || '' }}
# search_existing: open
filename: ./target/MARKER_REPORT_ISSUE.md
2 changes: 1 addition & 1 deletion .github/workflows/marker-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Cache LocalStack community dependencies (venv)
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install podman and test dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-pro-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ jobs:
token: ${{ secrets.PRO_ACCESS_TOKEN }}
path: localstack-ext

- name: Set up Python 3.11
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Set up Node 18.x
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.12
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# base: Stage which installs necessary runtime dependencies (OS packages, etc.)
#
FROM python:3.11.11-slim-bookworm@sha256:370c586a6ffc8c619e6d652f81c094b34b14b8f2fb9251f092de23f16e299b78 AS base
FROM python:3.12.8-slim-bookworm@sha256:2b0079146a74e23bf4ae8f6a28e1b484c6292f6fb904cbb51825b4a19812fcd8 AS base
ARG TARGETARCH

# Install runtime OS package dependencies
Expand Down Expand Up @@ -158,9 +158,9 @@ RUN --mount=type=cache,target=/root/.cache \
chmod -R 777 /usr/lib/localstack

# link the python package installer virtual environments into the localstack venv
RUN echo /var/lib/localstack/lib/python-packages/lib/python3.11/site-packages > localstack-var-python-packages-venv.pth && \
RUN echo /var/lib/localstack/lib/python-packages/lib/python3.12/site-packages > localstack-var-python-packages-venv.pth && \
mv localstack-var-python-packages-venv.pth .venv/lib/python*/site-packages/
RUN echo /usr/lib/localstack/python-packages/lib/python3.11/site-packages > localstack-static-python-packages-venv.pth && \
RUN echo /usr/lib/localstack/python-packages/lib/python3.12/site-packages > localstack-static-python-packages-venv.pth && \
mv localstack-static-python-packages-venv.pth .venv/lib/python*/site-packages/

# expose edge service, external service ports, and debugpy
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.s3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# base: Stage which installs necessary runtime dependencies (OS packages, filesystem...)
FROM python:3.11.11-slim-bookworm@sha256:370c586a6ffc8c619e6d652f81c094b34b14b8f2fb9251f092de23f16e299b78 AS base
FROM python:3.12.8-slim-bookworm@sha256:2b0079146a74e23bf4ae8f6a28e1b484c6292f6fb904cbb51825b4a19812fcd8 AS base
ARG TARGETARCH

# set workdir
Expand Down Expand Up @@ -66,7 +66,7 @@ RUN --mount=type=cache,target=/root/.cache \

# delete the botocore specs for other services (>80mb)
# TODO: well now it's compressed and it's much lighter: 20mb maybe not worth it
RUN find .venv/lib/python3.11/site-packages/botocore/data/ -mindepth 1 -maxdepth 1 -type d -not -name s3 -exec rm -rf '{}' \;
RUN find .venv/lib/python3.12/site-packages/botocore/data/ -mindepth 1 -maxdepth 1 -type d -not -name s3 -exec rm -rf '{}' \;


# final stage: Builds upon base stage and copies resources from builder stages
Expand Down Expand Up @@ -94,9 +94,9 @@ RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALSTACK_CORE=${LOCALSTACK_BUILD_VERSIO
make entrypoints

# link the python package installer virtual environments into the localstack venv
RUN echo /var/lib/localstack/lib/python-packages/lib/python3.11/site-packages > localstack-var-python-packages-venv.pth && \
RUN echo /var/lib/localstack/lib/python-packages/lib/python3.12/site-packages > localstack-var-python-packages-venv.pth && \
mv localstack-var-python-packages-venv.pth .venv/lib/python*/site-packages/
RUN echo /usr/lib/localstack/python-packages/lib/python3.11/site-packages > localstack-static-python-packages-venv.pth && \
RUN echo /usr/lib/localstack/python-packages/lib/python3.12/site-packages > localstack-static-python-packages-venv.pth && \
mv localstack-static-python-packages-venv.pth .venv/lib/python*/site-packages/

# expose edge service and debugpy
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/dev/run/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ContainerPaths:
"""Important paths in the container"""

project_dir: str = "/opt/code/localstack"
site_packages_target_dir: str = "/opt/code/localstack/.venv/lib/python3.11/site-packages"
site_packages_target_dir: str = "/opt/code/localstack/.venv/lib/python3.12/site-packages"
docker_entrypoint: str = "/usr/local/bin/docker-entrypoint.sh"
localstack_supervisor: str = "/usr/local/bin/localstack-supervisor"
localstack_source_dir: str
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
dynamic = ["version"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Topic :: Internet",
"Topic :: Software Development :: Testing",
Expand Down
2 changes: 1 addition & 1 deletion requirements-base-runtime.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=base-runtime --output-file=requirements-base-runtime.txt --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion requirements-basic.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements-basic.txt --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
Expand Down Expand Up @@ -35,7 +35,7 @@ aws-cdk-asset-node-proxy-agent-v6==2.1.0
# via aws-cdk-lib
aws-cdk-cloud-assembly-schema==38.0.1
# via aws-cdk-lib
aws-cdk-lib==2.173.1
aws-cdk-lib==2.173.2
# via localstack-core
aws-sam-translator==1.94.0
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements-runtime.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=runtime --output-file=requirements-runtime.txt --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
Expand Down
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=test --output-file=requirements-test.txt --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
Expand Down Expand Up @@ -35,7 +35,7 @@ aws-cdk-asset-node-proxy-agent-v6==2.1.0
# via aws-cdk-lib
aws-cdk-cloud-assembly-schema==38.0.1
# via aws-cdk-lib
aws-cdk-lib==2.173.1
aws-cdk-lib==2.173.2
# via localstack-core (pyproject.toml)
aws-sam-translator==1.94.0
# via
Expand Down
Loading
Loading