diff --git a/uv/src/uv/workspace/plan.py b/uv/src/uv/workspace/plan.py index 2ab185b..27ed7c1 100644 --- a/uv/src/uv/workspace/plan.py +++ b/uv/src/uv/workspace/plan.py @@ -224,7 +224,10 @@ async def create( raw_local = parse_local_packages(lock_data) # Overlay each target package's SDK (deduped); fall back to the # workspace root when no target is a local package. - codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."] + if all_packages: + codegen_paths = list(dict.fromkeys(raw_local.values())) or ["."] + else: + codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."] for codegen_path in codegen_paths: ws_dir = await _run_codegen(ws_dir, codegen_path) if workspace_path == ".": diff --git a/uv/tests/test_workspace_resolution.py b/uv/tests/test_workspace_resolution.py index 26e9ee5..401ab13 100644 --- a/uv/tests/test_workspace_resolution.py +++ b/uv/tests/test_workspace_resolution.py @@ -566,3 +566,22 @@ def test_root_workspace_paths_unchanged(self): for path in local.values(): resolved = posixpath.normpath(posixpath.join(".", path)) assert resolved == path + + +def test_codegen_paths_all_packages_visits_all_members(): + raw_local = { + "app-one": "packages/app-one", + "app-two": "packages/app-two", + } + # all_packages=True derives paths for all local workspace members + codegen_paths = list(dict.fromkeys(raw_local.values())) or ["."] + assert codegen_paths == ["packages/app-one", "packages/app-two"] + + # explicit selection visits only requested members + packages = ["app-one"] + codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."] + assert codegen_paths == ["packages/app-one"] + + # bare root fallback when no members or selection + codegen_paths = list(dict.fromkeys(raw_local[p] for p in [] if p in raw_local)) or ["."] + assert codegen_paths == ["."]