Fix Python container builds for workspace members above the workspace root#6929
Fix Python container builds for workspace members above the workspace root#6929chrislambert wants to merge 1 commit into
Conversation
|
@vimtor gentle nudge on this when you get a chance 🙏 Fixes #6928 — Python container builds break when a uv workspace member lives above the workspace root ( Should be safe to merge on your own read — every config this path touches fails unconditionally today, so there's no working setup it can regress. Targets cc @subssn21 as the author of that path in #6061 if you want a second set of eyes — no need to block on it though. Happy to adjust anything. |
Summary
Python container builds fail when a uv workspace member is referenced with a parent path (e.g.
members = ["../../lib"]). This PR copies such members into the docker build context and rewrites the requirements.txt lines and pyproject.toml member paths so uv can resolve them inside the image.Fixes #6928
Problem
uv exportwrites path members into requirements.txt as-is. A member above the workspace root produces a line like../../lib, which breaks container builds three ways:copyWorkspacePackagesForContainercopies the member tofilepath.Join(artifactDir, "../../lib"). That path is outside the docker build context, so the package never reaches the image.../../libagainst the requirements.txt location (/var/task) and fails.members = ["../../lib"], and uv's workspace validation fails when building the project in-image:Workspace member '/var/task/../../lib' is missing a 'pyproject.toml'Members inside the workspace root (
./core) are unaffected.Solution
In
copyWorkspacePackagesForContainer:../segments (../../libbecomes./lib).Compatibility:
Known limitation: literal member paths only. Parent-path globs (
members = ["../../packages/*"]) are not rewritten in pyproject.toml.Testing
TestCopyWorkspacePackagesForContainer: re-homing with requirements and pyproject rewrites, extras and markers preserved,./members unchanged, missing member directories left alone, source pyproject untouched.go test ./pkg/runtime/python/passes, gofmt and go vet clean.