Skip to content

uv lock collapses relative paths to editable builds in monorepo, breaks uv sync #6371

@leddy231

Description

@leddy231

Hi there! Excited to move our monorepo from poetry to uv.

There seems to be an issue with relative paths for editable installs in the lockfiles.
Using the following demo structure:

root
├-libs
│  ├-liba
│  └-libb
└-projects
   └-projecta

liba, libb, and projecta created with uv init

libb depends on liba with an editable install

dependencies = [
    "liba"
]

[tool.uv.sources]
liba = { path = "../../libs/liba", editable = true }

When locking libb with uv lock the path is resolved correctly, but also collapsed in the lockfile

[[package]]
name = "liba"
version = "0.1.0"
source = { editable = "../liba" }

This works fine since the path it correct.

However this does not work for projecta, which depends on libb:

dependencies = [
    "libb"
]

[tool.uv.sources]
libb = { path = "../../libs/libb", editable = true }

uv lock produces this lockfile:

version = 1
requires-python = ">=3.12"

[[package]]
name = "liba"
version = "0.1.0"
source = { editable = "../liba" }

[[package]]
name = "libb"
version = "0.1.0"
source = { editable = "../../libs/libb" }
dependencies = [
    { name = "liba" },
]

[package.metadata]
requires-dist = [{ name = "liba", editable = "../liba" }]

[[package]]
name = "projecta"
version = "0.1.0"
source = { editable = "." }
dependencies = [
    { name = "libb" },
]

[package.metadata]
requires-dist = [{ name = "libb", editable = "../../libs/libb" }]

Where the collapsed relative path is still used for liba, which no longer works.
This makes uv sync fail:

error: Failed to determine installation plan
  Caused by: Distribution not found at: file:///home/martin/uv_monorepo_bug/projects/liba

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions