Skip to content

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Nov 19, 2025

I initially thought I didn't need this, but in some contexts, the workspace member name is not useful at all and I just want to iterate over the paths without composing with uv workspace dir --package <name>

@zanieb zanieb added the preview Experimental behavior label Nov 19, 2025
@zanieb zanieb temporarily deployed to uv-test-registries November 19, 2025 15:42 — with GitHub Actions Inactive
In some contexts, the workspace member name is not useful at all and I just want to iterate over the paths without composing with `uv workspace dir --package <name>`
@zanieb zanieb force-pushed the zb/workspace-list-paths branch from a7c59c3 to 6f53063 Compare November 19, 2025 15:45
@zanieb zanieb changed the title zb/workspace list paths Add uv workspace list --paths Nov 19, 2025
@zanieb
Copy link
Member Author

zanieb commented Nov 19, 2025

Otherwise, the code I'm replacing looks like

index b66739d4..b15e6d79 100644
--- a/.../runner.py
+++ b/.../runner.py
@@ -45,13 +45,21 @@
 
 def find_workspace_members() -> Generator[pathlib.Path]:
     """Yield the root directories of all workspace members with tests."""
-    # TODO(zanieb): Use `uv metadata` for workspace member discovery once that exists
-    for path in WORKSPACE_ROOT.glob("foo-*/pyproject.toml"):
-        member_root = path.parent
-        if not (member_root / "tests").is_dir():
-            continue
-
-        yield member_root
+    output = subprocess.check_output(
+        ["uv", "workspace", "list", "--preview"], cwd=WORKSPACE_ROOT
+    )
+    for member in output.decode().splitlines():
+        member_root = (
+            subprocess.check_output(
+                ["uv", "workspace", "dir", "--preview", "--package", member],
+                cwd=WORKSPACE_ROOT,
+            )
+            .decode()
+            .strip()
+        )
+        path = pathlib.Path(member_root)
+        if (path / "tests").is_dir():
+            yield path
 

@zanieb zanieb temporarily deployed to uv-test-registries November 19, 2025 15:47 — with GitHub Actions Inactive
@zanieb zanieb requested a review from zsol November 20, 2025 18:31
Copy link
Member

@zsol zsol left a comment

Choose a reason for hiding this comment

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

nice

I was going to suggest listing both names and paths, but I realized paths are more powerful (one can always cd into it and look up the name).
Thoughts about changing the default to list paths and have a --names option instead?

@zanieb
Copy link
Member Author

zanieb commented Nov 20, 2025

You can also compose it the other direction, e.g., uv workspace dir --package <name>. I'm not sure one is inherently more powerful than the other. I find the names a little friendlier for the default output / consistent with the rest of uv.

@zanieb zanieb merged commit aebd757 into main Nov 20, 2025
100 checks passed
@zanieb zanieb deleted the zb/workspace-list-paths branch November 20, 2025 19:44
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 21, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.10` -> `0.9.11` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.11`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0911)

[Compare Source](astral-sh/uv@0.9.10...0.9.11)

Released on 2025-11-20.

##### Python

- Add CPython 3.15.0a2

See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20251120) for details.

##### Enhancements

- Add SBOM support to `uv export` ([#&#8203;16523](astral-sh/uv#16523))
- Publish to `crates.io` ([#&#8203;16770](astral-sh/uv#16770))

##### Preview features

- Add `uv workspace list --paths` ([#&#8203;16776](astral-sh/uv#16776))
- Fix the preview warning on `uv workspace dir` ([#&#8203;16775](astral-sh/uv#16775))

##### Bug fixes

- Fix `uv init` author serialization via `toml_edit` inline tables ([#&#8203;16778](astral-sh/uv#16778))
- Fix status messages without TTY ([#&#8203;16785](astral-sh/uv#16785))
- Preserve end-of-line comment whitespace when editing `pyproject.toml` ([#&#8203;16734](astral-sh/uv#16734))
- Disable `always-authenticate` when running under Dependabot ([#&#8203;16773](astral-sh/uv#16773))

##### Documentation

- Document the new behavior for free-threaded python versions ([#&#8203;16781](astral-sh/uv#16781))
- Improve note about build system in publish guide ([#&#8203;16788](astral-sh/uv#16788))
- Move do not upload publish note out of the guide into concepts ([#&#8203;16789](astral-sh/uv#16789))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants