Add hint when named index is found in a parent config file#18087
Add hint when named index is found in a parent config file#18087zanieb merged 2 commits intoastral-sh:mainfrom
Conversation
When a package in `tool.uv.sources` references a named index that isn't declared in `pyproject.toml` but is found in a configuration file (e.g., `uv.toml`), the error now includes a hint explaining that indexes referenced via `tool.uv.sources` must be defined in the project's `pyproject.toml`. Closes astral-sh#18053 https://claude.ai/code/session_01Bca43adRqTfi3czxQJDYPW
b9f3c3b to
39f0573
Compare
crates/uv/src/lib.rs
Outdated
| FilesystemOptions::user()? | ||
| .map(|options| options.with_index_origin(Origin::User)) | ||
| .combine( | ||
| FilesystemOptions::system()?.map(|options| options.with_index_origin(Origin::User)), |
There was a problem hiding this comment.
Do you want a separate enum for system vs. user?
There was a problem hiding this comment.
I think I do, yes. Thank you.
EliteTK
left a comment
There was a problem hiding this comment.
Regarding fixing origin tracking, I wrote something for this as part of the --index <name> PR: 85ec937
Although I guess I missed some indexes as I didn't end up needing to update the test snapshots...
Likewise to echo what Charlie said, I added a System origin too.
| config_index.and_then(|idx| { | ||
| let source = match idx.origin { | ||
| Some(Origin::User) => "a user-level `uv.toml`", | ||
| Some(Origin::Project) => "a project-level `uv.toml`", |
There was a problem hiding this comment.
Shouldn't this be "a pyproject.toml"?
There was a problem hiding this comment.
No, this is when there's a uv.toml in the project alongside the pyproject.toml,
There was a problem hiding this comment.
Ah, fair enough, you're right, I am pretty sure I realised this yesterday and then forgot about it when looking at it today :)
Test that the hint is shown when an index referenced in `tool.uv.sources` is defined in a user-level configuration file (`~/.config/uv/uv.toml`) rather than in the project's `pyproject.toml`. https://claude.ai/code/session_01Bca43adRqTfi3czxQJDYPW
39f0573 to
bee22c7
Compare
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 ([#​18116](astral-sh/uv#18116)) - Fix Python version selection for scripts with a `requires-python` conflicting with `.python-version` ([#​18097](astral-sh/uv#18097)) - Preserve file permissions when using reflinks on Linux ([#​18187](astral-sh/uv#18187)) ##### Documentation - Remove verbose documentation from optional dependencies help text ([#​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 ([#​18087](astral-sh/uv#18087)) - Add warning for `uv lock --frozen` ([#​17859](astral-sh/uv#17859)) - Attempt to use reflinks by default on Linux ([#​18117](astral-sh/uv#18117)) - Fallback to hardlinks after reflink failure before copying ([#​18104](astral-sh/uv#18104)) - Filter `pylock.toml` wheels by tags and `requires-python` ([#​18081](astral-sh/uv#18081)) - Validate wheel filenames are normalized during `uv publish` ([#​17783](astral-sh/uv#17783)) - Fix message when `exclude-newer` invalidates the lock file ([#​18100](astral-sh/uv#18100)) - Change the missing files log level to debug ([#​18075](astral-sh/uv#18075)) ##### Performance - Improve performance of repeated conflicts with an extra ([#​18094](astral-sh/uv#18094)) ##### Bug fixes - Fix `--no-emit-workspace` with `--all-packages` on single-member workspaces ([#​18098](astral-sh/uv#18098)) - Fix `UV_NO_DEFAULT_GROUPS` rejecting truthy values like `1` ([#​18057](astral-sh/uv#18057)) - Fix iOS detection ([#​17973](astral-sh/uv#17973)) - Propagate project-level conflicts to package extras ([#​18096](astral-sh/uv#18096)) - Use a global build concurrency semaphore ([#​18054](astral-sh/uv#18054)) ##### Documentation - Update documentation heading for environment variable files ([#​18122](astral-sh/uv#18122)) - Fix comment about `uv export` formats ([#​17900](astral-sh/uv#17900)) - Make it clear that Windows is supported in user- and system- level configuration docs ([#​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-->
See #18053