Skip to content

Commit 43fa5e2

Browse files
Add support for Python 3.15 (#888)
* Add python 3.15 * running integration tests * normalize logs * fix diff * nits
1 parent a733614 commit 43fa5e2

17 files changed

Lines changed: 3883 additions & 13 deletions

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
max-parallel: 4
4545
matrix:
46-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
46+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
4747

4848
steps:
4949
- name: Checkout

‎.github/workflows/build_layer.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
arch: [arm64, amd64]
18-
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
18+
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
1919

2020
steps:
2121
- name: Checkout

‎Dockerfile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ ARG runtime
77
RUN mkdir -p /build/python/lib/$runtime/site-packages
88
WORKDIR /build
99

10-
# Install newer version of GCC on AL2
10+
# AL2 SAM images (Python <= 3.11) ship GCC 7, which is too old to build ddtrace.
11+
# AL2023 SAM images already include GCC, find, and strip. The Lambda Python 3.15
12+
# preview image does not, so install that toolchain with dnf.
1113
RUN set -eux; \
1214
if command -v yum >/dev/null 2>&1; then \
1315
yum -y install git gcc10 gcc10-c++; \
@@ -16,6 +18,9 @@ RUN set -eux; \
1618
rm g++ && ln -s gcc10-g++ g++; \
1719
rm cc && ln -s gcc10-cc cc; \
1820
rm c++ && ln -s gcc10-c++ c++; \
21+
elif ! command -v gcc >/dev/null 2>&1 || ! command -v strip >/dev/null 2>&1 || ! command -v find >/dev/null 2>&1; then \
22+
dnf install -y gcc gcc-c++ make binutils findutils git; \
23+
dnf clean all; \
1924
fi
2025

2126
# Add Rust compiler which is needed to build dd-trace-py from source

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
77
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
88

9-
Datadog Lambda Library for Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14) enables [enhanced Lambda metrics](https://docs.datadoghq.com/serverless/enhanced_lambda_metrics), [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing), and [custom metric submission](https://docs.datadoghq.com/serverless/custom_metrics) from AWS Lambda functions.
9+
Datadog Lambda Library for Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14, and 3.15) enables [enhanced Lambda metrics](https://docs.datadoghq.com/serverless/enhanced_lambda_metrics), [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing), and [custom metric submission](https://docs.datadoghq.com/serverless/custom_metrics) from AWS Lambda functions.
1010

1111
## Installation
1212

‎ci/datasources/runtimes.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ runtimes:
5555
python_version: "3.14"
5656
arch: "arm64"
5757
image: "3.14.0"
58+
- name: "python315"
59+
python_version: "3.15"
60+
arch: "amd64"
61+
image: "3.15.0"
62+
- name: "python315"
63+
python_version: "3.15"
64+
arch: "arm64"
65+
image: "3.15.0"

‎ci/publish_layers.sh‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ AWS_CLI_PYTHON_VERSIONS=(
2525
"python3.13"
2626
"python3.14"
2727
"python3.14"
28+
"python3.15"
29+
"python3.15"
2830
)
2931
PYTHON_VERSIONS=(
3032
"3.8-amd64"
@@ -41,6 +43,8 @@ PYTHON_VERSIONS=(
4143
"3.13-arm64"
4244
"3.14-amd64"
4345
"3.14-arm64"
46+
"3.15-amd64"
47+
"3.15-arm64"
4448
)
4549
LAYER_PATHS=(
4650
".layers/datadog_lambda_py-amd64-3.8.zip"
@@ -57,6 +61,8 @@ LAYER_PATHS=(
5761
".layers/datadog_lambda_py-arm64-3.13.zip"
5862
".layers/datadog_lambda_py-amd64-3.14.zip"
5963
".layers/datadog_lambda_py-arm64-3.14.zip"
64+
".layers/datadog_lambda_py-amd64-3.15.zip"
65+
".layers/datadog_lambda_py-arm64-3.15.zip"
6066
)
6167
LAYERS=(
6268
"Datadog-Python38"
@@ -73,6 +79,8 @@ LAYERS=(
7379
"Datadog-Python313-ARM"
7480
"Datadog-Python314"
7581
"Datadog-Python314-ARM"
82+
"Datadog-Python315"
83+
"Datadog-Python315-ARM"
7684
)
7785
STAGES=('prod', 'sandbox', 'staging', 'gov-staging', 'gov-prod')
7886

‎pyproject.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ classifiers = [
2323
"Programming Language :: Python :: 3.12",
2424
"Programming Language :: Python :: 3.13",
2525
"Programming Language :: Python :: 3.14",
26+
"Programming Language :: Python :: 3.15",
2627
]
2728

2829
[tool.poetry.dependencies]
29-
python = ">=3.8.0,<3.15"
30+
python = ">=3.8.0,<3.16"
3031
datadog = ">=0.51.0,<1.0.0"
3132
wrapt = ">=1.11.2,!=2.2.0,<3"
3233
ddtrace = [

‎scripts/add_new_region.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ LAYER_NAMES=(
2727
"Datadog-Python313-ARM"
2828
"Datadog-Python314"
2929
"Datadog-Python314-ARM"
30+
"Datadog-Python315"
31+
"Datadog-Python315-ARM"
3032
)
3133
PYTHON_VERSIONS_FOR_AWS_CLI=(
3234
"python3.8"
@@ -43,6 +45,8 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
4345
"python3.13"
4446
"python3.14"
4547
"python3.14"
48+
"python3.15"
49+
"python3.15"
4650
)
4751
NEW_REGION=$1
4852

‎scripts/build_layers.sh‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ set -e
3636
LAYER_DIR=".layers"
3737
LAYER_FILES_PREFIX="datadog_lambda_py"
3838
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14")
39+
# Preview runtimes. AWS has not published a SAM build image for these, so the
40+
# Lambda preview base image is used instead. The Dockerfile installs the
41+
# compiler toolchain that image is missing.
42+
PREVIEW_PYTHON_VERSIONS=("3.15")
43+
ALL_PYTHON_VERSIONS=("${AVAILABLE_PYTHON_VERSIONS[@]}" "${PREVIEW_PYTHON_VERSIONS[@]}")
3944
AVAILABLE_ARCHS=("arm64" "amd64")
4045

4146
if [ -n "$ARCH" ]; then
@@ -69,11 +74,11 @@ fi
6974
# Determine which Python versions to build layers for
7075
if [ -z "$PYTHON_VERSION" ]; then
7176
echo "Python version not specified, building layers for all versions."
72-
PYTHON_VERSIONS=("${AVAILABLE_PYTHON_VERSIONS[@]}")
77+
PYTHON_VERSIONS=("${ALL_PYTHON_VERSIONS[@]}")
7378
else
7479
echo "Python version specified: $PYTHON_VERSION"
75-
if [[ ! " ${AVAILABLE_PYTHON_VERSIONS[@]} " =~ " ${PYTHON_VERSION} " ]]; then
76-
echo "Python version $PYTHON_VERSION is not a valid option. Choose from: ${AVAILABLE_PYTHON_VERSIONS[@]}"
80+
if [[ ! " ${ALL_PYTHON_VERSIONS[@]} " =~ " ${PYTHON_VERSION} " ]]; then
81+
echo "Python version $PYTHON_VERSION is not a valid option. Choose from: ${ALL_PYTHON_VERSIONS[@]}"
7782
echo ""
7883
echo "EXITING SCRIPT."
7984
exit 1
@@ -103,11 +108,17 @@ function docker_build_zip {
103108

104109
destination=$(make_path_absolute $2)
105110
arch=$3
111+
# Preview runtimes have no SAM build image yet. See PREVIEW_PYTHON_VERSIONS.
112+
if [[ " ${PREVIEW_PYTHON_VERSIONS[*]} " =~ " ${1} " ]]; then
113+
image="public.ecr.aws/lambda/python:${1}-preview"
114+
else
115+
image="public.ecr.aws/sam/build-python${1}:1"
116+
fi
106117
# Install datadogpy in a docker container to avoid the mess from switching
107118
# between different python runtimes.
108119
temp_dir=$(mktemp -d)
109120
docker buildx build -t datadog-lambda-python-${arch}:$1 . --no-cache \
110-
--build-arg image=public.ecr.aws/sam/build-python$1:1 \
121+
--build-arg image="${image}" \
111122
--build-arg runtime=python$1 \
112123
--platform linux/${arch} \
113124
--progress=plain \

‎scripts/list_layers.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ LAYER_NAMES=(
2525
"Datadog-Python313-ARM"
2626
"Datadog-Python314"
2727
"Datadog-Python314-ARM"
28+
"Datadog-Python315"
29+
"Datadog-Python315-ARM"
2830
)
2931
AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName')
3032
LAYERS_MISSING_REGIONS=()

0 commit comments

Comments
 (0)