From bac03acf0cea4791da64779b8b7cc09716337806 Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Thu, 21 May 2026 16:27:55 -0400 Subject: [PATCH] build(test-lambda-container): Migrate to uv and pyproject.toml Replace pip/requirements.txt with uv/pyproject.toml for dependency management. Update Dockerfile to use uv for installing dependencies. Refs PY-2459 Co-Authored-By: Claude Opus 4.6 --- test-lambda-container/Dockerfile | 13 ++++++------- test-lambda-container/pyproject.toml | 12 ++++++++++++ test-lambda-container/requirements.txt | 1 - 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 test-lambda-container/pyproject.toml delete mode 100644 test-lambda-container/requirements.txt diff --git a/test-lambda-container/Dockerfile b/test-lambda-container/Dockerfile index e8cef3e..6e91e40 100644 --- a/test-lambda-container/Dockerfile +++ b/test-lambda-container/Dockerfile @@ -3,21 +3,20 @@ FROM public.ecr.aws/lambda/python:3.11 # Add Sentry Layer COPY --from=public.ecr.aws/sentry/sentry-python-serverless-sdk:6 /opt/ /opt -# Copy requirements.txt -COPY requirements.txt ${LAMBDA_TASK_ROOT} +# Install uv +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +# Copy project files +COPY pyproject.toml ${LAMBDA_TASK_ROOT} # Copy function code COPY lambda_function.py ${LAMBDA_TASK_ROOT} # Install the specified packages -RUN pip install -r requirements.txt +RUN uv pip install --system --no-cache -r pyproject.toml ENV SENTRY_INITIAL_HANDLER="lambda_function.handler" ENV SENTRY_DSN="https://d655584d05f14c58b86e9034aab6817f@o447951.ingest.sentry.io/5461230" ENV SENTRY_TRACES_SAMPLE_RATE="1.0" -# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) -#CMD [ "lambda_function.handler" ] - CMD ["sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"] - diff --git a/test-lambda-container/pyproject.toml b/test-lambda-container/pyproject.toml new file mode 100644 index 0000000..db388b6 --- /dev/null +++ b/test-lambda-container/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "test-lambda-container" +version = "0" +requires-python = ">=3.11" + +dependencies = [ + "boto3>=1.38.0", + "sentry-sdk", +] + +[tool.uv.sources] +sentry-sdk = { path = "../../sentry-python", editable = true } diff --git a/test-lambda-container/requirements.txt b/test-lambda-container/requirements.txt deleted file mode 100644 index 1db657b..0000000 --- a/test-lambda-container/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -boto3 \ No newline at end of file