Skip to content

feat: Drop py3.7 #395

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 8 commits into from
Dec 12, 2023
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
4 changes: 2 additions & 2 deletions .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.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout
Expand All @@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
runtime-param: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
runtime-param: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.12

- name: Install Crossbuild Deps
run: |
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-Python37 ./scripts/publish_layers.sh
# Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python312 ./scripts/publish_layers.sh
VERSION=<VERSION> REGIONS=<REGION> LAYERS=<LAYER> ./scripts/publish_layers.sh
```

Expand Down
5 changes: 4 additions & 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.7, 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, 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.

## Installation

Expand Down Expand Up @@ -47,6 +47,9 @@ The Continuous Profiler works by spawning a thread which periodically wakes up a

## Major Version Notes

### 5.x / Layer version 86+
- Python3.7 support has been [deprecated](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) by AWS, and support removed from this library.

### 4.x / Layer version 61+

- Python3.6 support has been [deprecated](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) by AWS, and support removed from this library.
Expand Down
13 changes: 6 additions & 7 deletions datadog_lambda/cold_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,13 @@ def initialize_cold_start_tracing():
and os.environ.get("DD_TRACE_ENABLED", "true").lower() == "true"
and os.environ.get("DD_COLD_START_TRACING", "true").lower() == "true"
):
from sys import version_info, meta_path
from sys import meta_path

if version_info >= (3, 7): # current implementation only support version > 3.7
for importer in meta_path:
try:
importer.find_spec = wrap_find_spec(importer.find_spec)
except Exception:
pass
for importer in meta_path:
try:
importer.find_spec = wrap_find_spec(importer.find_spec)
except Exception:
pass


class ColdStartTracer(object):
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ packages = [
{ include = "datadog_lambda" }
]
classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -25,7 +24,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.7.0,<4"
python = ">=3.8.0,<4"
datadog = ">=0.41.0,<1.0.0"
wrapt = "^1.11.2"
ddtrace = ">=2.3.1"
Expand Down
2 changes: 0 additions & 2 deletions scripts/add_new_region.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set -e
OLD_REGION='us-east-1'

LAYER_NAMES=(
"Datadog-Python37"
"Datadog-Python38"
"Datadog-Python38-ARM"
"Datadog-Python39"
Expand All @@ -26,7 +25,6 @@ LAYER_NAMES=(
"Datadog-Python312-ARM"
)
PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.7"
"python3.8"
"python3.8"
"python3.9"
Expand Down
10 changes: 4 additions & 6 deletions scripts/build_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

# Builds datadog-lambda-python layers for Lambda functions

# Usage: PYTHON_VERSION=3.7 ./build_layers.sh
# Usage: PYTHON_VERSION=3.11 ./build_layers.sh
# If PYTHON_VERSION is not specified, all versions will be built.

set -e

LAYER_DIR=".layers"
LAYER_FILES_PREFIX="datadog_lambda_py"
AVAILABLE_PYTHON_VERSIONS=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
AVAILABLE_PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")

# Determine which Python versions to build layers for
if [ -z "$PYTHON_VERSION" ]; then
Expand Down Expand Up @@ -68,10 +68,8 @@ mkdir $LAYER_DIR

for python_version in "${PYTHON_VERSIONS[@]}"
do
if [ "$python_version" != "3.7" ]; then
echo "Building layer for Python ${python_version} arch=arm64"
docker_build_zip ${python_version} $LAYER_DIR/${LAYER_FILES_PREFIX}-arm64-${python_version}.zip arm64
fi
echo "Building layer for Python ${python_version} arch=arm64"
docker_build_zip ${python_version} $LAYER_DIR/${LAYER_FILES_PREFIX}-arm64-${python_version}.zip arm64
echo "Building layer for Python ${python_version} arch=amd64"
docker_build_zip ${python_version} $LAYER_DIR/${LAYER_FILES_PREFIX}-amd64-${python_version}.zip amd64
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_layer_size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MAX_LAYER_UNCOMPRESSED_SIZE_KB=$(expr 24 \* 1024)

LAYER_FILES_PREFIX="datadog_lambda_py"
LAYER_DIR=".layers"
VERSIONS=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")

for version in "${VERSIONS[@]}"
do
Expand Down
1 change: 0 additions & 1 deletion scripts/list_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
set -e

LAYER_NAMES=(
"Datadog-Python37"
"Datadog-Python38"
"Datadog-Python38-ARM"
"Datadog-Python39"
Expand Down
3 changes: 0 additions & 3 deletions scripts/publish_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set -e
trap "pkill -P $$; exit 1;" INT

PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.7"
"python3.8"
"python3.8"
"python3.9"
Expand All @@ -27,7 +26,6 @@ PYTHON_VERSIONS_FOR_AWS_CLI=(
"python3.12"
)
LAYER_PATHS=(
".layers/datadog_lambda_py-amd64-3.7.zip"
".layers/datadog_lambda_py-amd64-3.8.zip"
".layers/datadog_lambda_py-arm64-3.8.zip"
".layers/datadog_lambda_py-amd64-3.9.zip"
Expand All @@ -40,7 +38,6 @@ LAYER_PATHS=(
".layers/datadog_lambda_py-arm64-3.12.zip"
)
AVAILABLE_LAYERS=(
"Datadog-Python37"
"Datadog-Python38"
"Datadog-Python38-ARM"
"Datadog-Python39"
Expand Down
3 changes: 1 addition & 2 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ mismatch_found=false
# [0]: serverless runtime name
# [1]: python version
# [2]: random 8-character ID to avoid collisions with other runs
python37=("python3.7" "3.7" $(xxd -l 4 -c 4 -p < /dev/random))
python38=("python3.8" "3.8" $(xxd -l 4 -c 4 -p < /dev/random))
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))

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

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.7" "3.8" "3.9" "3.10" "3.11" "3.12")
PYTHON_VERSIONS=("3.8" "3.9" "3.10" "3.11" "3.12")

for python_version in "${PYTHON_VERSIONS[@]}"
do
Expand Down
1 change: 0 additions & 1 deletion scripts/sign_layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set -e

LAYER_DIR=".layers"
LAYER_FILES=(
"datadog_lambda_py-amd64-3.7.zip"
"datadog_lambda_py-amd64-3.8.zip"
"datadog_lambda_py-arm64-3.8.zip"
"datadog_lambda_py-amd64-3.9.zip"
Expand Down
Loading