Skip to content

chore: support python 3.13 #544

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

Merged
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ We love pull requests. For new features, consider opening an issue to discuss th
./scripts/build_layers.sh

# Publish the a testing layer to your own AWS account, and the ARN will be returned
# Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python312 ./scripts/publish_layers.sh
# Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python313 ./scripts/publish_layers.sh
VERSION=<VERSION> REGIONS=<REGION> LAYERS=<LAYER> ./scripts/publish_layers.sh
```

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ RUN rm -rf ./python/lib/$runtime/site-packages/setuptools
RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests
RUN find . -name 'libddwaf.so' -delete
# Comment this line out for now since ddtrace now tries to import it
#RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so
# RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/libdd_wrapper*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/ddup/_ddup.*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so
# _stack_v2 may not exist for some versions of ddtrace (e.g. under python 3.13)
RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so
# remove *.dist-info directories except any entry_points.txt files
RUN find ./python/lib/$runtime/site-packages/*.dist-info -not -name "entry_points.txt" -type f -delete
RUN find ./python/lib/$runtime/site-packages -type d -empty -delete
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)

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.
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.

## Installation

Expand Down
8 changes: 8 additions & 0 deletions ci/datasources/runtimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ runtimes:
python_version: "3.12"
arch: "arm64"
image: "3.12.0"
- name: "python313"
python_version: "3.13"
arch: "amd64"
image: "3.13.0"
- name: "python313"
python_version: "3.13"
arch: "arm64"
image: "3.13.0"
8 changes: 7 additions & 1 deletion ci/publish_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ AWS_CLI_PYTHON_VERSIONS=(
"python3.11"
"python3.12"
"python3.12"
"python3.13"
"python3.13"
)
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")
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")
LAYER_PATHS=(
".layers/datadog_lambda_py-amd64-3.8.zip"
".layers/datadog_lambda_py-arm64-3.8.zip"
Expand All @@ -34,6 +36,8 @@ LAYER_PATHS=(
".layers/datadog_lambda_py-arm64-3.11.zip"
".layers/datadog_lambda_py-amd64-3.12.zip"
".layers/datadog_lambda_py-arm64-3.12.zip"
".layers/datadog_lambda_py-amd64-3.13.zip"
".layers/datadog_lambda_py-arm64-3.13.zip"
)
LAYERS=(
"Datadog-Python38"
Expand All @@ -46,6 +50,8 @@ LAYERS=(
"Datadog-Python311-ARM"
"Datadog-Python312"
"Datadog-Python312-ARM"
"Datadog-Python313"
"Datadog-Python313-ARM"
)
STAGES=('prod', 'sandbox', 'staging')

Expand Down
641 changes: 344 additions & 297 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[tool.poetry.dependencies]
python = ">=3.8.0,<4"
datadog = ">=0.51.0,<1.0.0"
wrapt = "^1.11.2"
ddtrace = ">=2.17.0"
ddtrace = ">=2.20.0"
ujson = ">=5.9.0"
boto3 = { version = "^1.34.0", optional = true }
requests = { version ="^2.22.0", optional = true }
Expand Down
4 changes: 4 additions & 0 deletions scripts/add_new_region.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ LAYER_NAMES=(
"Datadog-Python311-ARM"
"Datadog-Python312"
"Datadog-Python312-ARM"
"Datadog-Python313"
"Datadog-Python313-ARM"
)
PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.8"
Expand All @@ -35,6 +37,8 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.11"
"python3.12"
"python3.12"
"python3.13"
"python3.13"
)
NEW_REGION=$1

Expand Down
4 changes: 2 additions & 2 deletions scripts/build_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set -e

LAYER_DIR=".layers"
LAYER_FILES_PREFIX="datadog_lambda_py"
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13")
AVAILABLE_ARCHS=("arm64" "amd64")

if [ -z "$ARCH" ]; then
Expand Down Expand Up @@ -61,7 +61,7 @@ function docker_build_zip {
# between different python runtimes.
temp_dir=$(mktemp -d)
docker buildx build -t datadog-lambda-python-${arch}:$1 . --no-cache \
--build-arg image=python:$1 \
--build-arg image=public.ecr.aws/docker/library/python:$1 \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we kept hitting rate limit errors from dockerhub, so we're switching to the public aws ecr instead.

--build-arg runtime=python$1 \
--platform linux/${arch} \
--progress=plain \
Expand Down
2 changes: 2 additions & 0 deletions scripts/list_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ LAYER_NAMES=(
"Datadog-Python311-ARM"
"Datadog-Python312"
"Datadog-Python312-ARM"
"Datadog-Python313"
"Datadog-Python313-ARM"
)
AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName')
LAYERS_MISSING_REGIONS=()
Expand Down
6 changes: 6 additions & 0 deletions scripts/publish_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.11"
"python3.12"
"python3.12"
"python3.13"
"python3.13"
)
LAYER_PATHS=(
".layers/datadog_lambda_py-amd64-3.8.zip"
Expand All @@ -36,6 +38,8 @@ LAYER_PATHS=(
".layers/datadog_lambda_py-arm64-3.11.zip"
".layers/datadog_lambda_py-amd64-3.12.zip"
".layers/datadog_lambda_py-arm64-3.12.zip"
".layers/datadog_lambda_py-amd64-3.13.zip"
".layers/datadog_lambda_py-arm64-3.13.zip"
)
AVAILABLE_LAYERS=(
"Datadog-Python38"
Expand All @@ -48,6 +52,8 @@ AVAILABLE_LAYERS=(
"Datadog-Python311-ARM"
"Datadog-Python312"
"Datadog-Python312-ARM"
"Datadog-Python313"
"Datadog-Python313-ARM"
)
AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName')

Expand Down
3 changes: 2 additions & 1 deletion scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ python39=("python3.9" "3.9" $(xxd -l 4 -c 4 -p < /dev/random))
python310=("python3.10" "3.10" $(xxd -l 4 -c 4 -p < /dev/random))
python311=("python3.11" "3.11" $(xxd -l 4 -c 4 -p < /dev/random))
python312=("python3.12" "3.12" $(xxd -l 4 -c 4 -p < /dev/random))
python313=("python3.13" "3.13" $(xxd -l 4 -c 4 -p < /dev/random))

PARAMETERS_SETS=("python38" "python39" "python310" "python311" "python312")
PARAMETERS_SETS=("python38" "python39" "python310" "python311" "python312" "python313")

if [ -z "$RUNTIME_PARAM" ]; then
echo "Python version not specified, running for all python versions."
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Run unit tests in Docker
set -e

PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")
PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13")

for python_version in "${PYTHON_VERSIONS[@]}"
do
Expand Down
2 changes: 2 additions & 0 deletions scripts/sign_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ LAYER_FILES=(
"datadog_lambda_py-arm64-3.11.zip"
"datadog_lambda_py-amd64-3.12.zip"
"datadog_lambda_py-arm64-3.12.zip"
"datadog_lambda_py-amd64-3.13.zip"
"datadog_lambda_py-arm64-3.13.zip"
)
SIGNING_PROFILE_NAME="DatadogLambdaSigningProfile"

Expand Down
2 changes: 1 addition & 1 deletion tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG python_version
FROM python:$python_version
FROM public.ecr.aws/docker/library/python:$python_version

ENV PYTHONDONTWRITEBYTECODE True

Expand Down
Loading
Loading