Skip to content

fix(uv): Preserve uv wrapper runfiles in lock targets - #4182

Open
hartikainen wants to merge 2 commits into
bazel-contrib:mainfrom
hartikainen:uv-lock-toolchain-runfiles
Open

hartikainen wants to merge 2 commits into
bazel-contrib:mainfrom
hartikainen:uv-lock-toolchain-runfiles

Conversation

@hartikainen

@hartikainen hartikainen commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

(Done with help from an agent.)

This PR lets uv_toolchain accept executable wrappers with multiple outputs and preserves their runfiles in lock actions and .run targets. This supports wrappers that obtain credentials before invoking uv.

Lock actions receive the executable target's FilesToRunProvider. Runnable targets merge its default runfiles, preserving runtime data, ordinary symlinks, and root symlinks. The downloaded uv binary has public visibility so wrappers can declare it as a runtime dependency.

The regression test covers a wrapper with multiple outputs, runtime data, and both kinds of runfiles symlinks.

Closes #4181.

Copilot AI lite review requested due to automatic review settings September 23, 2026 18:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The regression fixture does not cover multiple outputs or symlink runfiles, and the news entry needs the issue cross-reference.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

This PR updates uv_toolchain to support multi-output wrappers while preserving their runfiles in lock actions and .run targets.

Changes:

  • Supports multi-output executable wrappers.
  • Preserves runtime data and symlinks.
  • Adds regression fixtures and documentation.
File Summary
tests/​uv/​lock/​uv_with_runfiles.py Wrapper executable test helper
tests/​uv/​lock/​toolchain_runfiles_test.py Integration tests for lock targets
tests/​uv/​lock/​testdata/​toolchain_payload.txt Runtime payload fixture
tests/​uv/​lock/​lock_tests.bzl Toolchain and regression test setup
python/​uv/​private/​uv_toolchain.bzl Supports multi-output executables
python/​uv/​private/​uv_repository.bzl Makes downloaded binaries public
python/​uv/​private/​lock.bzl Preserves executable runfiles
news/​uv-toolchain-runfiles.fixed.md Documents the behavior change

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/uv/lock/lock_tests.bzl
Comment thread news/4181.fixed.md
Allow executable wrappers with multiple output files and include their
runfiles in lock actions and runnable targets. This lets a `py_binary`
wrapper supply authentication without losing its runtime dependencies.
Export downloaded `uv` binaries so wrappers can depend on them directly.

Cover build-action and runtime resolution with a custom toolchain that
reads a declared data file.
@hartikainen
hartikainen force-pushed the uv-lock-toolchain-runfiles branch from 02eb1f0 to d34813a Compare September 23, 2026 18:41
@hartikainen
hartikainen force-pushed the uv-lock-toolchain-runfiles branch from 15b1d4b to 4191059 Compare September 25, 2026 01:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support executable wrappers in uv_toolchain

2 participants