Skip to content

Fix --no-emit-workspace with --all-packages on single-member workspaces#18098

Merged
zanieb merged 3 commits intoastral-sh:mainfrom
zaniebot:claude/fix-uv-issue-18070-02eGz
Feb 19, 2026
Merged

Fix --no-emit-workspace with --all-packages on single-member workspaces#18098
zanieb merged 3 commits intoastral-sh:mainfrom
zaniebot:claude/fix-uv-issue-18070-02eGz

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Feb 19, 2026

Closes #18070

Fixes an issue where --no-emit-workspace --all-packages would incorrectly emit -e . (the workspace root) when the workspace contained only a single member at the root.

When a workspace contains a single member at the root, that member is not included in the lockfile's members set (it's empty). The --all-packages flag uses InstallTarget::Workspace, which returned None for project_name(). This meant include_package() had no way to identify the root project as a workspace member — neither the project_name check nor the members.contains() check could match it, so it passed through the --no-emit-workspace filter.

…le-member workspaces

When a workspace contains a single member at the root, it is omitted from
the lockfile's members set. The `--all-packages` flag selects the
`InstallTarget::Workspace` variant, which returned `None` for
`project_name()`. This meant that `include_package()` could not identify
the root project as a workspace member to filter it out when
`--no-emit-workspace` was passed.

The fix returns the root project's name from `project_name()` when the
lockfile's members set is empty, matching the existing fallback in
`roots()`.

Closes astral-sh#18070

https://claude.ai/code/session_01DwLXfeSGDiCyR5rrcn7kxj
@zanieb zanieb added the bug Something isn't working label Feb 19, 2026
@zanieb zanieb marked this pull request as ready for review February 19, 2026 00:09
@konstin
Copy link
Member

konstin commented Feb 19, 2026

When a workspace contains a single member at the root, that member is not included in the lockfile's members set (it's empty).

Why is that, shouldn't we instead ensure that the members list is accurate?

@zanieb
Copy link
Member Author

zanieb commented Feb 19, 2026

It's intentional behavior

// If this is a non-virtual project with a single member, we can omit it from the lockfile.
// If any members are added or removed, it will inherently mismatch. If the member is
// renamed, it will also mismatch.
if members.len() == 1 && !workspace.is_non_project() {
members.clear();
}
and has been longstanding #6091

I don't think we should change it, since it'll churn lock files. If we see more problems, we can consider it.

@zanieb
Copy link
Member Author

zanieb commented Feb 19, 2026

I think it's intended to avoid a noisy members manifest when you're not actually using a workspace.

@konstin
Copy link
Member

konstin commented Feb 19, 2026

That's a confusing edge case to do this on the Workspace level instead of the lockfile boundary.

Comment on lines +2286 to +2287
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
Copy link
Member

Choose a reason for hiding this comment

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

Here we don't build the project, We should use uv_build for all new test packages, it's faster and uses no network for the cases where we do.

@zanieb zanieb enabled auto-merge (squash) February 19, 2026 14:51
@zanieb zanieb merged commit 10b35e6 into astral-sh:main Feb 19, 2026
103 of 104 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 25, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [uv](https://github.com/astral-sh/uv) | patch | `0.10.4` → `0.10.6` |

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 (uv)</summary>

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

[Compare Source](astral-sh/uv@0.10.5...0.10.6)

Released on 2026-02-24.

##### Bug fixes

- Apply lockfile marker normalization for fork markers ([#&#8203;18116](astral-sh/uv#18116))
- Fix Python version selection for scripts with a `requires-python` conflicting with `.python-version` ([#&#8203;18097](astral-sh/uv#18097))
- Preserve file permissions when using reflinks on Linux ([#&#8203;18187](astral-sh/uv#18187))

##### Documentation

- Remove verbose documentation from optional dependencies help text ([#&#8203;18180](astral-sh/uv#18180))

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

[Compare Source](astral-sh/uv@0.10.4...0.10.5)

Released on 2026-02-23.

##### Enhancements

- Add hint when named index is found in a parent config file ([#&#8203;18087](astral-sh/uv#18087))
- Add warning for `uv lock --frozen` ([#&#8203;17859](astral-sh/uv#17859))
- Attempt to use reflinks by default on Linux ([#&#8203;18117](astral-sh/uv#18117))
- Fallback to hardlinks after reflink failure before copying ([#&#8203;18104](astral-sh/uv#18104))
- Filter `pylock.toml` wheels by tags and `requires-python` ([#&#8203;18081](astral-sh/uv#18081))
- Validate wheel filenames are normalized during `uv publish` ([#&#8203;17783](astral-sh/uv#17783))
- Fix message when `exclude-newer` invalidates the lock file ([#&#8203;18100](astral-sh/uv#18100))
- Change the missing files log level to debug ([#&#8203;18075](astral-sh/uv#18075))

##### Performance

- Improve performance of repeated conflicts with an extra ([#&#8203;18094](astral-sh/uv#18094))

##### Bug fixes

- Fix `--no-emit-workspace` with `--all-packages` on single-member workspaces ([#&#8203;18098](astral-sh/uv#18098))
- Fix `UV_NO_DEFAULT_GROUPS` rejecting truthy values like `1` ([#&#8203;18057](astral-sh/uv#18057))
- Fix iOS detection ([#&#8203;17973](astral-sh/uv#17973))
- Propagate project-level conflicts to package extras ([#&#8203;18096](astral-sh/uv#18096))
- Use a global build concurrency semaphore ([#&#8203;18054](astral-sh/uv#18054))

##### Documentation

- Update documentation heading for environment variable files ([#&#8203;18122](astral-sh/uv#18122))
- Fix comment about `uv export` formats ([#&#8203;17900](astral-sh/uv#17900))
- Make it clear that Windows is supported in user- and system- level configuration docs ([#&#8203;18106](astral-sh/uv#18106))

</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:eyJjcmVhdGVkSW5WZXIiOiI0My4zMS4xIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv export ignores --no-emit-workspace if --all-packages is passed but there are not additional packages in the workspace

3 participants