From 57f2fbde2fe056b75b3c0cb03967ff8e5ea2ccf0 Mon Sep 17 00:00:00 2001 From: Michael He Date: Thu, 9 Jan 2025 19:29:06 +0000 Subject: [PATCH 1/2] pin setuptools version to 75.2.0 --- Dockerfile | 12 +----------- aws-opentelemetry-distro/pyproject.toml | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index dbffb395c..c75a13587 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,17 +18,7 @@ ADD aws-opentelemetry-distro/ ./aws-opentelemetry-distro/ # * https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#troubleshoot-cannot-import-cygrpc RUN sed -i "/opentelemetry-exporter-otlp-proto-grpc/d" ./aws-opentelemetry-distro/pyproject.toml -# urllib3 recently made a release that drops support for Python 3.8 -# Our sdk depends on botocore which pulls in the version of urllib3 based Python runtime it detects. -# The rule is that if current pip command version is > 3.9 botocore will pick up the latest urllib3, -# otherwise it picks up the older urllib3 that is compatible with Python 3.8. -# https://github.com/boto/botocore/blob/develop/requirements-docs.txt -# Since this Dockerfile currently uses the fixed Python 3.11 base image to pull the required dependencies, -# EKS and ECS applications will encounter a runtime error for Python 3.8 compatibility. -# Our fix is to temporarily restrict the urllib3 version to one that works for all supported Python versions -# that we currently commit to support (notably 3.8). -# TODO: Remove this temporary workaround once we deprecate Python 3.8 support since it has reached end-of-life. -RUN mkdir workspace && pip install urllib3==2.2.3 --target workspace ./aws-opentelemetry-distro +RUN mkdir workspace && pip install --target workspace ./aws-opentelemetry-distro # Stage 2: Build the cp-utility binary FROM public.ecr.aws/docker/library/rust:1.81 as builder diff --git a/aws-opentelemetry-distro/pyproject.toml b/aws-opentelemetry-distro/pyproject.toml index d4f9ca204..a1decdc93 100644 --- a/aws-opentelemetry-distro/pyproject.toml +++ b/aws-opentelemetry-distro/pyproject.toml @@ -80,6 +80,20 @@ dependencies = [ "opentelemetry-instrumentation-urllib3 == 0.48b0", "opentelemetry-instrumentation-wsgi == 0.48b0", "opentelemetry-instrumentation-cassandra == 0.48b0", + # urllib3 recently made a release that drops support for Python 3.8 + # Our sdk depends on botocore which pulls in the version of urllib3 based Python runtime it detects. + # The rule is that if current pip command version is > 3.9 botocore will pick up the latest urllib3, + # otherwise it picks up the older urllib3 that is compatible with Python 3.8. + # https://github.com/boto/botocore/blob/develop/requirements-docs.txt + # Since this Dockerfile currently uses the fixed Python 3.11 base image to pull the required dependencies, + # EKS and ECS applications will encounter a runtime error for Python 3.8 compatibility. + # Our fix is to temporarily restrict the urllib3 version to one that works for all supported Python versions + # that we currently commit to support (notably 3.8). + # We also pin the setuptools version for similar issues with the library dropping 3.8 support. + # https://github.com/pypa/setuptools/blame/main/pkg_resources/__init__.py#L24 + # TODO: Remove these temporary workarounds once we deprecate Python 3.8 support since it has reached end-of-life. + "urllib3 == 2.2.3", + "setuptools == 75.2.0", ] [project.optional-dependencies] From d0a5747047ca070273df98b3520b8399a7c49fd7 Mon Sep 17 00:00:00 2001 From: Michael He Date: Thu, 9 Jan 2025 20:58:44 +0000 Subject: [PATCH 2/2] move dependency restrictions back to upper level command --- Dockerfile | 14 +++++++++++++- aws-opentelemetry-distro/pyproject.toml | 14 -------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index c75a13587..d2f4ed6c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,19 @@ ADD aws-opentelemetry-distro/ ./aws-opentelemetry-distro/ # * https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#troubleshoot-cannot-import-cygrpc RUN sed -i "/opentelemetry-exporter-otlp-proto-grpc/d" ./aws-opentelemetry-distro/pyproject.toml -RUN mkdir workspace && pip install --target workspace ./aws-opentelemetry-distro +# urllib3 recently made a release that drops support for Python 3.8 +# Our sdk depends on botocore which pulls in the version of urllib3 based Python runtime it detects. +# The rule is that if current pip command version is > 3.9 botocore will pick up the latest urllib3, +# otherwise it picks up the older urllib3 that is compatible with Python 3.8. +# https://github.com/boto/botocore/blob/develop/requirements-docs.txt +# Since this Dockerfile currently uses the fixed Python 3.11 base image to pull the required dependencies, +# EKS and ECS applications will encounter a runtime error for Python 3.8 compatibility. +# Our fix is to temporarily restrict the urllib3 version to one that works for all supported Python versions +# that we currently commit to support (notably 3.8). +# We also pin the setuptools version for similar issues with the library dropping 3.8 support. +# https://github.com/pypa/setuptools/blame/main/pkg_resources/__init__.py#L24 +# TODO: Remove these temporary workarounds once we deprecate Python 3.8 support since it has reached end-of-life. +RUN mkdir workspace && pip install setuptools==75.2.0 urllib3==2.2.3 --target workspace ./aws-opentelemetry-distro # Stage 2: Build the cp-utility binary FROM public.ecr.aws/docker/library/rust:1.81 as builder diff --git a/aws-opentelemetry-distro/pyproject.toml b/aws-opentelemetry-distro/pyproject.toml index a1decdc93..d4f9ca204 100644 --- a/aws-opentelemetry-distro/pyproject.toml +++ b/aws-opentelemetry-distro/pyproject.toml @@ -80,20 +80,6 @@ dependencies = [ "opentelemetry-instrumentation-urllib3 == 0.48b0", "opentelemetry-instrumentation-wsgi == 0.48b0", "opentelemetry-instrumentation-cassandra == 0.48b0", - # urllib3 recently made a release that drops support for Python 3.8 - # Our sdk depends on botocore which pulls in the version of urllib3 based Python runtime it detects. - # The rule is that if current pip command version is > 3.9 botocore will pick up the latest urllib3, - # otherwise it picks up the older urllib3 that is compatible with Python 3.8. - # https://github.com/boto/botocore/blob/develop/requirements-docs.txt - # Since this Dockerfile currently uses the fixed Python 3.11 base image to pull the required dependencies, - # EKS and ECS applications will encounter a runtime error for Python 3.8 compatibility. - # Our fix is to temporarily restrict the urllib3 version to one that works for all supported Python versions - # that we currently commit to support (notably 3.8). - # We also pin the setuptools version for similar issues with the library dropping 3.8 support. - # https://github.com/pypa/setuptools/blame/main/pkg_resources/__init__.py#L24 - # TODO: Remove these temporary workarounds once we deprecate Python 3.8 support since it has reached end-of-life. - "urllib3 == 2.2.3", - "setuptools == 75.2.0", ] [project.optional-dependencies]