Simplify uv sync command invocation in setup_monorepo.sh#24
Conversation
The monorepo setup hard-links bin/setup.sh into each member repo, so this reflects the simplified sync_workspace() from upstream. https://claude.ai/code/session_01VWAaDgYuHTEC95Z71bjyV2
| if uv sync --all-packages --all-extras --no-cache --active; then | ||
| return | ||
| fi | ||
|
|
||
| warn "'uv sync --all-packages --all-extras --no-cache --active' failed; retrying without --all-extras" | ||
| "${uv_sync_basic[@]}" | ||
| uv sync --all-packages --no-cache --active |
There was a problem hiding this comment.
🟡 Removal of env -u UV_NO_SOURCES causes uv sync to skip workspace sources when env var is set
The old sync_workspace() explicitly unset UV_NO_SOURCES and UV_NO_SOURCES_PACKAGE via env -u before calling uv sync. This was important because the monorepo setup requires workspace source resolution to link member packages together. The new code calls uv sync directly, so if either env var is set, uv sync will skip source-based resolution and likely fail or produce an incomplete environment.
This repo's own CI workflow sets UV_NO_SOURCES: "1" globally (.github/workflows/test-parallel.yml:14). While the CI doesn't invoke setup_monorepo.sh directly, a developer who has UV_NO_SOURCES=1 in their shell (e.g., copied from CI env for debugging) and then runs this setup script will get a broken workspace sync.
| if uv sync --all-packages --all-extras --no-cache --active; then | |
| return | |
| fi | |
| warn "'uv sync --all-packages --all-extras --no-cache --active' failed; retrying without --all-extras" | |
| "${uv_sync_basic[@]}" | |
| uv sync --all-packages --no-cache --active | |
| if env -u UV_NO_SOURCES -u UV_NO_SOURCES_PACKAGE uv sync --all-packages --all-extras --no-cache --active; then | |
| return | |
| fi | |
| warn "'uv sync --all-packages --all-extras --no-cache --active' failed; retrying without --all-extras" | |
| env -u UV_NO_SOURCES -u UV_NO_SOURCES_PACKAGE uv sync --all-packages --no-cache --active |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Refactored the
sync_workspace()function to simplify the uv sync command invocation by removing unnecessary array variable declarations and directly invoking the commands inline.Key Changes
uv_sync_allanduv_sync_basicarray variable declarations that were used to construct the uv sync commands"${uv_sync_all[@]}"→uv sync --all-packages --all-extras --no-cache --active"${uv_sync_basic[@]}"→uv sync --all-packages --no-cache --activeImplementation Details
The refactoring improves code readability by eliminating intermediate variable declarations while preserving the exact same functionality. The
env -u UV_NO_SOURCES -u UV_NO_SOURCES_PACKAGEprefix was removed, which appears to have been unnecessary for the actual command execution.https://claude.ai/code/session_01VWAaDgYuHTEC95Z71bjyV2
Summary by cubic
Simplified
uvsync invocation by inlining commands inbin/setup_monorepo.sh, removing array-built commands. Matches the upstream script and keeps the same behavior and retry path.uv_sync_all/uv_sync_basicarrays with directuv synccalls.env -u UV_NO_SOURCES -u UV_NO_SOURCES_PACKAGEprefix.Written for commit c47413b. Summary will update on new commits.