Skip to content

Commit 9e7c385

Browse files
apiarian-datadogmabdinur
authored andcommitted
chore: support python 3.13 (#544)
1 parent c074363 commit 9e7c385

18 files changed

+3645
-309
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
strategy:
4242
max-parallel: 4
4343
matrix:
44-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
44+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
4545

4646
steps:
4747
- name: Checkout

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ We love pull requests. For new features, consider opening an issue to discuss th
2424
./scripts/build_layers.sh
2525
2626
# Publish the a testing layer to your own AWS account, and the ARN will be returned
27-
# Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python312 ./scripts/publish_layers.sh
27+
# Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python313 ./scripts/publish_layers.sh
2828
VERSION=<VERSION> REGIONS=<REGION> LAYERS=<LAYER> ./scripts/publish_layers.sh
2929
```
3030

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ RUN rm -rf ./python/lib/$runtime/site-packages/setuptools
2323
RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests
2424
RUN find . -name 'libddwaf.so' -delete
2525
# Comment this line out for now since ddtrace now tries to import it
26-
#RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/*.so
27-
RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so
26+
# RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so
2827
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/libdd_wrapper*.so
2928
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/ddup/_ddup.*.so
30-
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so
29+
# _stack_v2 may not exist for some versions of ddtrace (e.g. under python 3.13)
30+
RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so
3131
# remove *.dist-info directories except any entry_points.txt files
3232
RUN find ./python/lib/$runtime/site-packages/*.dist-info -not -name "entry_points.txt" -type f -delete
3333
RUN find ./python/lib/$runtime/site-packages -type d -empty -delete

README.md

+1-1
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, and 3.12) 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, and 3.13) 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

+8
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ runtimes:
3939
python_version: "3.12"
4040
arch: "arm64"
4141
image: "3.12.0"
42+
- name: "python313"
43+
python_version: "3.13"
44+
arch: "amd64"
45+
image: "3.13.0"
46+
- name: "python313"
47+
python_version: "3.13"
48+
arch: "arm64"
49+
image: "3.13.0"

ci/publish_layers.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ AWS_CLI_PYTHON_VERSIONS=(
2121
"python3.11"
2222
"python3.12"
2323
"python3.12"
24+
"python3.13"
25+
"python3.13"
2426
)
25-
PYTHON_VERSIONS=("3.8-amd64" "3.8-arm64" "3.9-amd64" "3.9-arm64" "3.10-amd64" "3.10-arm64" "3.11-amd64" "3.11-arm64" "3.12-amd64" "3.12-arm64")
27+
PYTHON_VERSIONS=("3.8-amd64" "3.8-arm64" "3.9-amd64" "3.9-arm64" "3.10-amd64" "3.10-arm64" "3.11-amd64" "3.11-arm64" "3.12-amd64" "3.12-arm64" "3.13-amd64" "3.13-arm64")
2628
LAYER_PATHS=(
2729
".layers/datadog_lambda_py-amd64-3.8.zip"
2830
".layers/datadog_lambda_py-arm64-3.8.zip"
@@ -34,6 +36,8 @@ LAYER_PATHS=(
3436
".layers/datadog_lambda_py-arm64-3.11.zip"
3537
".layers/datadog_lambda_py-amd64-3.12.zip"
3638
".layers/datadog_lambda_py-arm64-3.12.zip"
39+
".layers/datadog_lambda_py-amd64-3.13.zip"
40+
".layers/datadog_lambda_py-arm64-3.13.zip"
3741
)
3842
LAYERS=(
3943
"Datadog-Python38"
@@ -46,6 +50,8 @@ LAYERS=(
4650
"Datadog-Python311-ARM"
4751
"Datadog-Python312"
4852
"Datadog-Python312-ARM"
53+
"Datadog-Python313"
54+
"Datadog-Python313-ARM"
4955
)
5056
STAGES=('prod', 'sandbox', 'staging')
5157

poetry.lock

+344-297
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.10",
2222
"Programming Language :: Python :: 3.11",
2323
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
2425
]
2526

2627
[tool.poetry.dependencies]

scripts/add_new_region.sh

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ LAYER_NAMES=(
2323
"Datadog-Python311-ARM"
2424
"Datadog-Python312"
2525
"Datadog-Python312-ARM"
26+
"Datadog-Python313"
27+
"Datadog-Python313-ARM"
2628
)
2729
PYTHON_VERSIONS_FOR_AWS_CLI=(
2830
"python3.8"
@@ -35,6 +37,8 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
3537
"python3.11"
3638
"python3.12"
3739
"python3.12"
40+
"python3.13"
41+
"python3.13"
3842
)
3943
NEW_REGION=$1
4044

scripts/build_layers.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e
1414

1515
LAYER_DIR=".layers"
1616
LAYER_FILES_PREFIX="datadog_lambda_py"
17-
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")
17+
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13")
1818
AVAILABLE_ARCHS=("arm64" "amd64")
1919

2020
if [ -z "$ARCH" ]; then
@@ -61,7 +61,7 @@ function docker_build_zip {
6161
# between different python runtimes.
6262
temp_dir=$(mktemp -d)
6363
docker buildx build -t datadog-lambda-python-${arch}:$1 . --no-cache \
64-
--build-arg image=python:$1 \
64+
--build-arg image=public.ecr.aws/docker/library/python:$1 \
6565
--build-arg runtime=python$1 \
6666
--platform linux/${arch} \
6767
--progress=plain \

scripts/list_layers.sh

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ LAYER_NAMES=(
2121
"Datadog-Python311-ARM"
2222
"Datadog-Python312"
2323
"Datadog-Python312-ARM"
24+
"Datadog-Python313"
25+
"Datadog-Python313-ARM"
2426
)
2527
AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName')
2628
LAYERS_MISSING_REGIONS=()

scripts/publish_layers.sh

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
2424
"python3.11"
2525
"python3.12"
2626
"python3.12"
27+
"python3.13"
28+
"python3.13"
2729
)
2830
LAYER_PATHS=(
2931
".layers/datadog_lambda_py-amd64-3.8.zip"
@@ -36,6 +38,8 @@ LAYER_PATHS=(
3638
".layers/datadog_lambda_py-arm64-3.11.zip"
3739
".layers/datadog_lambda_py-amd64-3.12.zip"
3840
".layers/datadog_lambda_py-arm64-3.12.zip"
41+
".layers/datadog_lambda_py-amd64-3.13.zip"
42+
".layers/datadog_lambda_py-arm64-3.13.zip"
3943
)
4044
AVAILABLE_LAYERS=(
4145
"Datadog-Python38"
@@ -48,6 +52,8 @@ AVAILABLE_LAYERS=(
4852
"Datadog-Python311-ARM"
4953
"Datadog-Python312"
5054
"Datadog-Python312-ARM"
55+
"Datadog-Python313"
56+
"Datadog-Python313-ARM"
5157
)
5258
AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName')
5359

scripts/run_integration_tests.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ python39=("python3.9" "3.9" $(xxd -l 4 -c 4 -p < /dev/random))
3232
python310=("python3.10" "3.10" $(xxd -l 4 -c 4 -p < /dev/random))
3333
python311=("python3.11" "3.11" $(xxd -l 4 -c 4 -p < /dev/random))
3434
python312=("python3.12" "3.12" $(xxd -l 4 -c 4 -p < /dev/random))
35+
python313=("python3.13" "3.13" $(xxd -l 4 -c 4 -p < /dev/random))
3536

36-
PARAMETERS_SETS=("python38" "python39" "python310" "python311" "python312")
37+
PARAMETERS_SETS=("python38" "python39" "python310" "python311" "python312" "python313")
3738

3839
if [ -z "$RUNTIME_PARAM" ]; then
3940
echo "Python version not specified, running for all python versions."

scripts/run_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Run unit tests in Docker
99
set -e
1010

11-
PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")
11+
PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13")
1212

1313
for python_version in "${PYTHON_VERSIONS[@]}"
1414
do

scripts/sign_layers.sh

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ LAYER_FILES=(
1919
"datadog_lambda_py-arm64-3.11.zip"
2020
"datadog_lambda_py-amd64-3.12.zip"
2121
"datadog_lambda_py-arm64-3.12.zip"
22+
"datadog_lambda_py-amd64-3.13.zip"
23+
"datadog_lambda_py-arm64-3.13.zip"
2224
)
2325
SIGNING_PROFILE_NAME="DatadogLambdaSigningProfile"
2426

tests/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG python_version
2-
FROM python:$python_version
2+
FROM public.ecr.aws/docker/library/python:$python_version
33

44
ENV PYTHONDONTWRITEBYTECODE True
55

0 commit comments

Comments
 (0)