Skip to content

Improve --exclude-newer hints #18952

Merged
zanieb merged 3 commits intomainfrom
charlie/exclude-newer-hint
Apr 15, 2026
Merged

Improve --exclude-newer hints #18952
zanieb merged 3 commits intomainfrom
charlie/exclude-newer-hint

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh commented Apr 9, 2026

Summary

We now show a hint if there's an available version that's excluded and would satisfy the range (and include that version in the hint). Previously, we only showed this if all versions were omitted.

For example:

  × No solution found when resolving dependencies:
  ╰─▶ Because there are no versions of iniconfig and iniconfig==2.0.0 was published after the exclude newer time, we can conclude that all versions of iniconfig cannot be used.
      And because your project depends on iniconfig, we can conclude that your project's requirements are unsatisfiable.

      hint: `iniconfig` was filtered by `exclude-newer` to only include packages uploaded before 2006-12-02T02:07:43Z. The latest version satisfying the requirement is v2.0.0, published on 2023-01-07. Consider using `exclude-newer-
  package` to override the cutoff for this package.

Closes #18220.

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Apr 9, 2026
Comment thread crates/uv-static/src/env_vars.rs Outdated
/// intentional filtering. Should be set to an RFC 3339 timestamp (e.g., `2024-03-25T00:00:00Z`).
#[attr_hidden]
#[attr_added_in("0.11.7")]
pub const UV_INTERNAL__EXCLUDE_NEWER_HINT: &'static str = "UV_INTERNAL__EXCLUDE_NEWER_HINT";
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ensures that when we determine the "latest available version", we still filter to make the test deterministic.

@mschoettle
Copy link
Copy Markdown

I just ran into an issue where exclude-newer is set to 7 days but pyproject.toml was updated by Renovate (forgot to configure minimum release age for it) to a ruff version that was released outside that range.

I got this error message and it took me some digging to figure out exclude-newer was the cause:

$ uv lock
  × No solution found when resolving dependencies for split (markers: python_full_version == '3.13.13' and sys_platform ==
  │ 'win32'):
  ╰─▶ Because there is no version of ruff==0.15.9 and admin:dev depends on ruff==0.15.9, we can conclude that admin:dev's
      requirements are unsatisfiable.
      And because your project requires admin:dev, we can conclude that your project's requirements are unsatisfiable.

      hint: The resolution failed for an environment that is not the current one, consider limiting the environments with
      `tool.uv.environments`.

Does this PR address this problem or is that a separate issue?

@charliermarsh
Copy link
Copy Markdown
Member Author

Yeah I believe it would tell you that in the hint.

@charliermarsh charliermarsh force-pushed the charlie/exclude-newer-hint branch 2 times, most recently from ffc92ac to a12bb7b Compare April 9, 2026 18:08
@nsoranzo
Copy link
Copy Markdown
Contributor

nsoranzo commented Apr 9, 2026

@mschoettle See also the related #18914 issue.

@charliermarsh charliermarsh force-pushed the charlie/exclude-newer-hint branch from a12bb7b to f6bfc4a Compare April 9, 2026 18:24
@charliermarsh charliermarsh force-pushed the charlie/exclude-newer-hint branch from f6bfc4a to 9f1be9b Compare April 9, 2026 18:36

/// Collect the version ranges in `derivation_tree` that were excluded solely by
/// `exclude-newer`, grouped by package name.
fn subtree_exclude_newer_ranges(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The complexity here is that we want to figure out which (excluded) version matches the resolver specifiers for that package. But the ExcludeNewer incompatibilities cause us to exclude the exact versions we care about! So we have to remove those incompatibilities from the tree.

@charliermarsh charliermarsh marked this pull request as ready for review April 9, 2026 18:55
@charliermarsh charliermarsh requested a review from zanieb April 9, 2026 18:55
Comment thread crates/uv-resolver/src/pubgrub/report.rs Outdated
Comment thread crates/uv-resolver/src/pubgrub/report.rs Outdated
Comment thread crates/uv-resolver/src/resolver/mod.rs Outdated
Comment thread crates/uv-resolver/src/resolver/mod.rs Outdated
Comment thread crates/uv-static/src/env_vars.rs Outdated
Comment thread crates/uv-static/src/env_vars.rs Outdated
Comment thread crates/uv-test/src/lib.rs Outdated
Comment thread crates/uv-test/src/lib.rs Outdated
Comment thread crates/uv-test/src/lib.rs Outdated
Comment thread crates/uv/tests/it/pip_install.rs
Comment thread crates/uv-resolver/src/error.rs Outdated
@zanieb zanieb merged commit fb3b502 into main Apr 15, 2026
112 checks passed
@zanieb zanieb deleted the charlie/exclude-newer-hint branch April 15, 2026 16:39
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Apr 16, 2026
This MR contains the following updates:

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

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.11.7`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0117)

[Compare Source](astral-sh/uv@0.11.6...0.11.7)

Released on 2026-04-15.

##### Python

- Upgrade CPython build to [`2026041`](astral-sh/uv@20260414) including an OpenSSL security upgrade ([#&#8203;19004](astral-sh/uv#19004))

##### Enhancements

- Elevate configuration errors to `required-version` mismatches ([#&#8203;18977](astral-sh/uv#18977))
- Further improve TLS certificate validation messages ([#&#8203;18933](astral-sh/uv#18933))
- Improve `--exclude-newer` hints  ([#&#8203;18952](astral-sh/uv#18952))

##### Preview features

- Fix `--script` handling in `uv audit` ([#&#8203;18970](astral-sh/uv#18970))
- Fix traversal of extras in `uv audit` ([#&#8203;18970](astral-sh/uv#18970))

##### Bug fixes

- De-quote `workspace metadata` in linehaul data ([#&#8203;18966](astral-sh/uv#18966))
- Avoid installing tool workspace member dependencies as editable ([#&#8203;18891](astral-sh/uv#18891))
- Emit JSON report for `uv sync --check` failures ([#&#8203;18976](astral-sh/uv#18976))
- Filter and warn on invalid TLS certificates ([#&#8203;18951](astral-sh/uv#18951))
- Fix equality comparisons for version specifiers with `~=` operators ([#&#8203;18960](astral-sh/uv#18960))
- Fix stale Python upgrade preview feature check in project environment construction ([#&#8203;18961](astral-sh/uv#18961))
- Improve Windows path normalization ([#&#8203;18945](astral-sh/uv#18945))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

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

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include earliest valid date in exclude-newer resolver hint

4 participants