Make local uv dependencies hermetic in Python container builds - #6965
Open
achadha235 wants to merge 1 commit into
Open
Make local uv dependencies hermetic in Python container builds#6965achadha235 wants to merge 1 commit into
achadha235 wants to merge 1 commit into
Conversation
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.
Fixes #6964 and #6928
Problem
Python container artifacts previously preserved local paths from
uv export. Those paths are valid in the source checkout but not necessarily in the Docker build context. This includes the../../membercases reported in #6928 and custom Dockerfiles that install local dependencies before their source is available. This also affects custom Dockerfiles that copy the full SST artifact before installation. Since the artifact is not a copy of the original uv workspace layout, runninguv syncor regenerating requirements inside the image failed to resolve workspace dependencies.Solution
For container builds, SST now:
.sst/packages/;requirements.txtto reference that artifact-local archive; andThis keeps the generated artifact self-contained and avoids recreating or rewriting the user's uv workspace layout inside Docker.
materializeContainerRequirementsreads and rewrites the exported requirements file.rewriteContainerRequirementsresolves and deduplicates local paths while preserving extras and environment markers.buildContainerSdistwrites each package archive below the artifact root.Why this approach
I believe this is a more robust solution than #6929 because it packages the resolved local dependencies instead of recreating the source workspace inside Docker by copying directories and rewriting relative paths. That keeps the artifact independent of the developers layout and avoids requiring uv to reconstruct the workspace from a partial build context.
Testing
Tests cover parent-path workspace members, descendant path dependencies, duplicate local dependencies, extras and markers, missing packages, and artifact-path containment.
I've added a test build at my fork achadha235/sst
yellowbrick-sst-v0.1.0for validating the change against existing Python setups before merge. I've already used this in production with my own project and it seems to be working well.@chrislambert @subssn21 I'd appreciate if you could have a look and validate against your own Python SST setups