From 7a43a5d8ec91ebd44ec39cb76f7842317f7ae7f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Apr 2026 23:00:05 +0000 Subject: [PATCH] Enable Python bytecode compilation in uv Dockerfile template Added UV_COMPILE_BYTECODE=1 to the base stage of the Python uv Dockerfile template with explanatory comments about the tradeoff (longer build time for faster cold-start). Mirrors the docs guidance in livekit/web#4070. --- pkg/agentfs/examples/python.uv.Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/agentfs/examples/python.uv.Dockerfile b/pkg/agentfs/examples/python.uv.Dockerfile index ef85b085..403eb992 100644 --- a/pkg/agentfs/examples/python.uv.Dockerfile +++ b/pkg/agentfs/examples/python.uv.Dockerfile @@ -12,6 +12,11 @@ FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS base # the application crashes without emitting any logs due to buffering. ENV PYTHONUNBUFFERED=1 +# Compile Python source to bytecode (.pyc) during install so the first import +# doesn't pay the compilation cost. This reduces agent cold-start time at the +# expense of a slightly longer build. +ENV UV_COMPILE_BYTECODE=1 + # --- Build stage --- # Install dependencies, build native extensions, and prepare the application FROM base AS build