Skip to content

Allow workspace root to override member non-workspace sources - #18954

Draft
zanieb wants to merge 4 commits into
astral-sh:mainfrom
zaniebot:claude/investigate-uv-regression-Koid1
Draft

zanieb wants to merge 4 commits into
astral-sh:mainfrom
zaniebot:claude/investigate-uv-regression-Koid1

Conversation

@zanieb

@zanieb zanieb commented Apr 9, 2026

Copy link
Copy Markdown
Member

Closes #18232 which regressed due to #16296

… for workspace members

When a workspace member (e.g., `app-a`) declares a non-workspace source (Git, path, etc.)
for another workspace member (e.g., `lib-x`) in its `tool.uv.sources`, but the workspace
root declares `lib-x = { workspace = true }`, fall back to the workspace root's source
instead of raising a `NonWorkspaceSource` error.

This supports the pattern where members declare Git sources for standalone use outside
the workspace, while the workspace root overrides them as workspace sources when
developing within the monorepo.

The regression was introduced in v0.9.3 when commit b151e0e fixed workspace member
glob normalization for `./` prefixed paths. Before that fix, workspaces using
`members = ["./packages/..."]` didn't properly discover members from child directories,
so the workspace member source check didn't fire.

Fixes astral-sh#18232

https://claude.ai/code/session_01XBDgKsN3dyqoucYic8YNGn
@zaniebot
zaniebot force-pushed the claude/investigate-uv-regression-Koid1 branch from ca1a046 to f06ae1c Compare June 18, 2026 22:03
Comment thread crates/uv-distribution/src/metadata/lowering.rs Outdated
Comment thread crates/uv-distribution/src/metadata/lowering.rs Outdated
Comment thread crates/uv-distribution/src/metadata/lowering.rs Outdated
Comment on lines +68 to +83
let (sources, origin) = if matches!(origin, RequirementOrigin::Project)
&& workspace.packages().contains_key(&requirement.name)
&& let Some(project_sources) = sources
&& project_sources
.iter()
.any(|source| !matches!(source, Source::Workspace { .. }))
&& let Some(workspace_sources) = workspace.sources().get(&requirement.name)
&& workspace_sources.iter().any(|source| {
matches!(
source,
Source::Workspace {
workspace: true,
..
}
)
}) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This seems dubious, we'll want to confirm this is the best way to express this.

@zanieb

zanieb commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

@EliteTK I rebased this

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.

override-dependencies no longer allows workspace sources to override Git sources in workspace members (0.9.2 → 0.9.3+)

3 participants