-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate OC Python projects to uv (SMR-8) (#2984)
- Loading branch information
1 parent
8e7710a
commit ea9758a
Showing
21 changed files
with
666 additions
and
1,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
FROM python:3.13.0-slim-bullseye AS builder | ||
FROM ghcr.io/astral-sh/uv:0.5.14 AS uv | ||
|
||
# Install the same version of Poetry as inside the dev container | ||
RUN pip install --no-cache-dir poetry==1.8.3 | ||
# First, bundle the dependencies into the task root. | ||
FROM public.ecr.aws/lambda/python:3.13 AS builder | ||
|
||
# Enable bytecode compilation, to improve cold-start performance. | ||
ENV UV_COMPILE_BYTECODE=1 | ||
|
||
# Disable installer metadata, to create a deterministic layer. | ||
ENV UV_NO_INSTALLER_METADATA=1 | ||
|
||
# Enable copy mode to support bind mount caching. | ||
ENV UV_LINK_MODE=copy | ||
|
||
# Copy uv binary | ||
COPY --from=uv /uv /bin/uv | ||
|
||
# Copy dependency files | ||
WORKDIR /app | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN poetry export --without-hashes --format=requirements.txt > requirements.txt | ||
COPY pyproject.toml uv.lock ./ | ||
|
||
# Generate requirements.txt and install dependencies | ||
RUN uv export --frozen --no-emit-workspace --no-dev --no-editable -o requirements.txt && \ | ||
uv pip install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" | ||
|
||
FROM public.ecr.aws/lambda/python:3.11 | ||
FROM public.ecr.aws/lambda/python:3.13 | ||
|
||
COPY --from=builder /app/requirements.txt ${LAMBDA_TASK_ROOT}/ | ||
COPY openchallenges_data_lambda/app.py ${LAMBDA_TASK_ROOT}/ | ||
# Copy the runtime dependencies from the builder stage. | ||
COPY --from=builder ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT} | ||
|
||
RUN python3.11 -m pip install --no-cache-dir -r requirements.txt -t . | ||
# Copy the application code. | ||
COPY ./openchallenges_data_lambda ${LAMBDA_TASK_ROOT}/app | ||
|
||
# Command can be overwritten by providing a different command in the template directly. | ||
CMD ["app.lambda_handler"] | ||
CMD ["app.app.lambda_handler"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
[tool.poetry] | ||
[build-system] | ||
requires = ["pdm-backend"] | ||
build-backend = "pdm.backend" | ||
|
||
[project] | ||
authors = [ | ||
{name = "Verena Chung", email = "[email protected]"}, | ||
] | ||
requires-python = "==3.13.1" | ||
dependencies = [ | ||
"requests==2.32.3", | ||
"gspread==6.1.4", | ||
"pandas==2.2.3", | ||
"numpy==2.1.0", | ||
] | ||
name = "openchallenges-data-lambda" | ||
version = "0.1.0" | ||
description = "A containerized AWS Lambda to import challenge data into the OC database" | ||
authors = ["Verena Chung <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "3.11.10" | ||
requests = "2.32.3" | ||
gspread = "6.1.4" | ||
pandas = "2.2.3" | ||
numpy = "2.1.0" | ||
[dependency-groups] | ||
dev = [] | ||
prod = [] | ||
test = [] | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
[tool.uv] | ||
default-groups = [] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.