Repository navigation
Use uv bytecode compilation across sample Dockerfiles - #1166
Draft
Wenxing Zhu (Wixee) wants to merge 2 commits into
Draft
Wenxing Zhu (Wixee) wants to merge 2 commits into
Wenxing Zhu (Wixee) wants to merge 2 commits into
Conversation
Wenxing Zhu (Wixee)
requested review from
a team,
JiahuiGu (Jiahui-Gu) and
Ying Hua (herohua)
as code owners
November 13, 2026 09:37
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the Dockerfile bytecode-compilation simplification.
No open issues 🎉
What changed in this PR
Simplifies bytecode precompilation in ten Python hosted-agent Dockerfiles, following the cold-start optimization work in #1153.
Changes:
- Adds
--compile-bytecodeto frozen uv dependency installation and removes separatecompileallcommands. - Limits precompilation to dependencies, dropping standard-library/application compilation and strict application syntax checks.
- Updates cold-start and
PYTHONDONTWRITEBYTECODEguidance while leaving dependency versions, base images, and entrypoints unchanged.
| File | Description |
|---|---|
samples/python/hosted-agents/langgraph/responses/15-branching/src/langgraph-branching/Dockerfile |
Uses uv bytecode compilation for the branching sample. |
samples/python/hosted-agents/langgraph/responses/14-middleware/src/langgraph-middleware/Dockerfile |
Uses uv bytecode compilation for the middleware sample. |
samples/python/hosted-agents/langgraph/responses/13-custom-store/src/custom-store/Dockerfile |
Uses uv bytecode compilation for the custom-store sample. |
samples/python/hosted-agents/langgraph/responses/11-deep-agents/src/langgraph-deep-agents/Dockerfile |
Uses uv bytecode compilation for the deep-agents sample. |
samples/python/hosted-agents/langgraph/responses/10-run/src/langgraph-run-responses/Dockerfile |
Uses uv bytecode compilation for the responses runner. |
samples/python/hosted-agents/langgraph/responses/09-resilient/src/langchain-azure-resilient-responses/Dockerfile |
Uses uv bytecode compilation for resilient responses. |
samples/python/hosted-agents/langgraph/responses/08-observability/src/langgraph-observability-responses/Dockerfile |
Uses uv bytecode compilation for the observability sample. |
samples/python/hosted-agents/langgraph/invocations/03-run/src/langgraph-run-invocations/Dockerfile |
Uses uv bytecode compilation for the invocations runner. |
samples/python/hosted-agents/langgraph/invocations/02-resilient/src/langchain-azure-resilient-invocations/Dockerfile |
Uses uv bytecode compilation for resilient invocations. |
samples/python/hosted-agents/agent-framework/responses/22-foundry-toolbox-mcp-skills/src/agent-framework-agent-foundry-toolbox-mcp-skills-responses/Dockerfile |
Uses uv bytecode compilation for the Agent Framework toolbox-skills sample. |
Review effort: Balanced
Wenxing Zhu (Wixee)
marked this pull request as draft
November 13, 2026 09:47
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use uv's built-in
--compile-bytecodeduring frozen dependency installation across all uv-based sample Dockerfiles instead of separate manual compilation commands.PYTHONDONTWRITEBYTECODEguidance next to dependency installation. Clarify that the variable disables automatic writes on import, but Python can still read valid.pycfiles.site-packagesonly. Unlike the removed manual passes, it does not precompile the standard library or copied application code, or perform a strict application syntax check.Related: #1153.
Validation
.pycgeneration and dependency import with bytecode writes disabled in an isolated uv-managed environment.