Skip to content

Add initial hidden uv upgrade command#19678

Merged
zsol merged 3 commits into
mainfrom
zsol/uv-upgrade-initial-slice
Jun 8, 2026
Merged

Add initial hidden uv upgrade command#19678
zsol merged 3 commits into
mainfrom
zsol/uv-upgrade-initial-slice

Conversation

@zsol

@zsol zsol commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

This introduces a hidden initial implementation of uv upgrade <package> to validate dependency selection, constraint rewriting, and resolver integration before enabling manifest or lockfile updates.

For a single production dependency, the command:

  • validates that the dependency is uniquely declared and registry-backed
  • removes upper and equality constraints while preserving lower bounds, exclusions, extras, and markers
  • performs a targeted universal resolution using existing lockfile preferences for unselected packages
  • reports the selected package’s resolved version change

This initial slice is deliberately read-only: it does not modify pyproject.toml, uv.lock, or .venv. It also rejects unsupported cases explicitly, including multi-member workspaces, dynamic project versions, direct URLs, non-registry sources, and self-dependencies.

Integration coverage includes successful upgrades, unchanged versions, resolution failures, explicit registry sources, nested single-member workspaces, constraint handling, and no-mutation guarantees.

Tip

This PR is organized into distinct, easier-to-review commits

@zsol zsol changed the title Add initial hidden uv upgrade support Add initial hidden uv upgrade command Jun 4, 2026
@zsol zsol force-pushed the zsol/uv-upgrade-initial-slice branch from cfcc8a7 to 5043c81 Compare June 5, 2026 08:51
@astral-sh-bot

astral-sh-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the latest main baseline.

  • Added tests: 25
  • Removed tests: 0
  • Changed suites: 3
uv: +5 / -0

Added:

  • uv::commands::project::upgrade::tests::relax_requirement_converts_compatible_release_to_lower_bound
  • uv::commands::project::upgrade::tests::relax_requirement_preserves_lower_bounds_and_exclusions
  • uv::commands::project::upgrade::tests::relax_requirement_preserves_requirement_metadata
  • uv::commands::project::upgrade::tests::relax_requirement_removes_blocking_only_constraints
  • uv::settings::tests::upgrade_settings_target_only_requested_package

Removed: none

uv-workspace: +1 / -0

Added:

  • uv-workspace::pyproject_mut::test::replace_dependency_preserves_source

Removed: none

uv::it: +19 / -0

Added:

  • uv::it::upgrade::upgrade_allows_registry_source
  • uv::it::upgrade::upgrade_help
  • uv::it::upgrade::upgrade_ignores_inapplicable_non_registry_source
  • uv::it::upgrade::upgrade_rejects_direct_url_requirement
  • uv::it::upgrade::upgrade_rejects_duplicate_production_dependencies
  • uv::it::upgrade::upgrade_rejects_dynamic_project_version
  • uv::it::upgrade::upgrade_rejects_multi_member_workspace
  • uv::it::upgrade::upgrade_rejects_non_registry_source_for_top_level_extra
  • uv::it::upgrade::upgrade_rejects_non_registry_sources
  • uv::it::upgrade::upgrade_rejects_self_dependency
  • uv::it::upgrade::upgrade_rejects_virtual_workspace_root
  • uv::it::upgrade::upgrade_rejects_workspace_root_non_registry_source
  • uv::it::upgrade::upgrade_reports_no_solution_without_mutation
  • uv::it::upgrade::upgrade_reports_no_version_change_without_mutation
  • uv::it::upgrade::upgrade_requires_current_project
  • uv::it::upgrade::upgrade_requires_production_dependency
  • uv::it::upgrade::upgrade_resolves_nested_workspace_member_without_mutation
  • uv::it::upgrade::upgrade_resolves_selected_dependency_without_mutation
  • uv::it::upgrade::upgrade_selects_normalized_production_dependency

Removed: none

@zsol zsol force-pushed the zsol/uv-upgrade-initial-slice branch from 5043c81 to 224443a Compare June 5, 2026 10:07
@zsol zsol marked this pull request as ready for review June 5, 2026 10:24
@zsol zsol requested a review from konstin June 5, 2026 10:25
exclude-newer = "2024-03-25T00:00:00Z"

[tool.uv.sources]
anyio = { git = "https://github.com/agronholm/anyio", marker = "python_version < '3.12'" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if we pinned a commit and wanted that upgraded?

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.

I think that's out of scope for now, we can ignore these now and add support later (although I'm not entirely clear on how would we define what an "upgrade" is for an arbitrary commit)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably reject those cases explicitly, telling the user that we can't upgrade commit-to-commit (which is something that's reasonable to want as a user, but not really something that git does)

@zsol zsol merged commit 2cb9eed into main Jun 8, 2026
56 checks passed
@zsol zsol deleted the zsol/uv-upgrade-initial-slice branch June 8, 2026 09:21
zsol added a commit that referenced this pull request Jun 9, 2026
## Summary

`uv upgrade` cannot meaningfully upgrade a Git dependency that specifies
`rev`: the revision may name a commit, branch, or tag, but there is no
registry version constraint for the command to relax. Previously, these
dependencies fell through to the generic non-registry-source error,
which obscured that commit-to-commit upgrades are unsupported.

This follow-up to #19678 detects applicable Git sources with `rev`
before the generic source check and reports a dedicated error. It also
extracts the shared source-applicability check into a helper and adds an
integration snapshot covering the new diagnostic.
@konstin konstin added the preview Experimental behavior label Jun 10, 2026
konstin added a commit that referenced this pull request Jun 10, 2026
Released on 2026-06-10.

### Enhancements

- Add `--emit-index-url` and `--emit-find-links` to `uv export`
([#18370](#18370))
- Add `--find-links` support for `uv pip list`
([#16103](#16103))
- Group executable install errors during `uv python install`
([#19691](#19691))
- Use ICF in macOS release builds to reduce binary sizes
([#19615](#19615))

### Preview features

- Add initial hidden `uv upgrade` command
([#19678](#19678))
- Reject Git revisions in `uv upgrade`
([#19742](#19742))

### Configuration

- Recognize `UV_NO_INSTALL_PROJECT`, `UV_NO_INSTALL_WORKSPACE`,
`UV_NO_INSTALL_LOCAL`
([#19323](#19323))

### Performance

- Speed up discovery of large workspaces
([#18311](#18311))

### Bug fixes

- Allow unknown preview flags with a warning again
([#19669](#19669))
- Apply dependency exclusions to direct requirements
([#19699](#19699))
- Avoid following external symlinks during cache clean
([#19682](#19682))
- Avoid following symlinks during cache prune
([#19543](#19543))
- Fix Git cache keys for worktrees and packed refs
([#19706](#19706))
- Make resolver error handling iterative to avoid stack overflows
([#19695](#19695))
- Pass `VIRTUAL_ENV` through `cygpath` inside `fish` on Windows
([#19703](#19703))
- Rebuild explicit local directory tool installs
([#19591](#19591))
- Validate egg top-level entries as identifiers
([#19679](#19679))

### Documentation

- Document `--find-links` caching behavior
([#19585](#19585))
- Add a small section for malware checks
([#19680](#19680))
blake-hamm added a commit to blake-hamm/bhamm-lab that referenced this pull request Jun 10, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ghcr.io/astral-sh/uv](https://github.com/astral-sh/uv) | stage | patch | `0.11.19` → `0.11.20` |

---

### Release Notes

<details>
<summary>astral-sh/uv (ghcr.io/astral-sh/uv)</summary>

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

Released on 2026-06-10.

##### Enhancements

- Add `--emit-index-url` and `--emit-find-links` to `uv export` ([#&#8203;18370](astral-sh/uv#18370))
- Add `--find-links` support for `uv pip list` ([#&#8203;16103](astral-sh/uv#16103))
- Group executable install errors during `uv python install` ([#&#8203;19691](astral-sh/uv#19691))
- Use ICF in macOS release builds to reduce binary sizes ([#&#8203;19615](astral-sh/uv#19615))

##### Preview features

- Add initial hidden `uv upgrade` command ([#&#8203;19678](astral-sh/uv#19678))
- Reject Git revisions in `uv upgrade` ([#&#8203;19742](astral-sh/uv#19742))

##### Configuration

- Recognize `UV_NO_INSTALL_PROJECT`, `UV_NO_INSTALL_WORKSPACE`, `UV_NO_INSTALL_LOCAL` ([#&#8203;19323](astral-sh/uv#19323))

##### Performance

- Speed up discovery of large workspaces ([#&#8203;18311](astral-sh/uv#18311))

##### Bug fixes

- Allow unknown preview flags with a warning again ([#&#8203;19669](astral-sh/uv#19669))
- Apply dependency exclusions to direct requirements ([#&#8203;19699](astral-sh/uv#19699))
- Avoid following external symlinks during cache clean ([#&#8203;19682](astral-sh/uv#19682))
- Avoid following symlinks during cache prune ([#&#8203;19543](astral-sh/uv#19543))
- Fix Git cache keys for worktrees and packed refs ([#&#8203;19706](astral-sh/uv#19706))
- Make resolver error handling iterative to avoid stack overflows ([#&#8203;19695](astral-sh/uv#19695))
- Pass `VIRTUAL_ENV` through `cygpath` inside `fish` on Windows ([#&#8203;19703](astral-sh/uv#19703))
- Rebuild explicit local directory tool installs ([#&#8203;19591](astral-sh/uv#19591))
- Validate egg top-level entries as identifiers ([#&#8203;19679](astral-sh/uv#19679))

##### Documentation

- Document `--find-links` caching behavior ([#&#8203;19585](astral-sh/uv#19585))
- Add a small section for malware checks ([#&#8203;19680](astral-sh/uv#19680))

</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 PR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

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

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjAuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: Renovate Bot <renovate@bhamm-lab.com>
Reviewed-on: https://codeberg.org/blake-hamm/bhamm-lab/pulls/186
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.

2 participants