Allow explicit values with uv version --bump#16555
Conversation
| `stable`, `alpha`, `beta`, `rc`, `post`, and `dev`. When provided more than once, the components | ||
| will be applied in order, from largest (`major`) to smallest (`dev`). | ||
|
|
||
| You can optionally provide a numeric value with `--bump <component>=<value>` to set the resulting |
There was a problem hiding this comment.
As a note, I don't think this belongs in the "guide" long-term — this kind of less common functionality belongs in the "concepts" section but we don't have one for uv version yet.
I guess it'd be a "Project version" section in https://docs.astral.sh/uv/concepts/projects/config/ ? We should open an issue to track that work and ref this comment.
crates/uv-cli/src/lib.rs
Outdated
| let value = | ||
| match value { |
There was a problem hiding this comment.
aside: i am perplexed by rustfmt selecting this
There was a problem hiding this comment.
Looked into this and it seems to be because of the multiline RHS expression, I kinda like this better:
let value = match value {
Some(raw) if raw.is_empty() => {
return Err("`--bump` values cannot be empty".to_string());
}
Some(raw) => Some(
raw.parse::<u64>()
.map_err(|_| format!("invalid numeric value `{raw}` for `--bump {name}`"))?,
),
None => None,
};(no rustfmt interference here 😅)
|
(Btw the actual clap parser work is rad, and thank you for jumping on this!) |
| pyproject_toml.write_str( | ||
| r#" | ||
| [project] | ||
| name = "myproject" | ||
| version = "0.1.0.dev4" | ||
| requires-python = ">=3.12" | ||
| "#, | ||
| )?; |
There was a problem hiding this comment.
aside: There are a few other places we manually dedent like this (and then some places we don't dedent at all). We may want to pull in something like indoc and use it everywhere to be consistent.
| } else { | ||
| full.post = Some(1); | ||
| // Either bump or set to 1 | ||
| if let Some(post) = &mut full.post { | ||
| *post += 1; | ||
| } else { | ||
| full.post = Some(1); | ||
| } | ||
| } |
There was a problem hiding this comment.
This could technically be made into an else-if but it's consistent with the other block to not, so on balance this is probably better..?
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.8` -> `0.9.9` | 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.9`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#099) [Compare Source](astral-sh/uv@0.9.8...0.9.9) Released on 2025-11-12. ##### Deprecations - Deprecate use of `--project` in `uv init` ([#​16674](astral-sh/uv#16674)) ##### Enhancements - Add iOS support to Python interpreter discovery ([#​16686](astral-sh/uv#16686)) - Reject ambiguously parsed URLs ([#​16622](astral-sh/uv#16622)) - Allow explicit values in `uv version --bump` ([#​16555](astral-sh/uv#16555)) - Warn on use of managed pre-release Python versions when a stable version is available ([#​16619](astral-sh/uv#16619)) - Allow signing trampolines on Windows by using `.rcdata` to store metadata ([#​15068](astral-sh/uv#15068)) - Add `--only-emit-workspace` and similar variants to `uv export` ([#​16681](astral-sh/uv#16681)) ##### Preview features - Add `uv workspace dir` command ([#​16678](astral-sh/uv#16678)) - Add `uv workspace metadata` command ([#​16516](astral-sh/uv#16516)) ##### Configuration - Add `UV_NO_DEFAULT_GROUPS` environment variable ([#​16645](astral-sh/uv#16645)) ##### Bug fixes - Remove `torch-model-archiver` and `torch-tb-profiler` from PyTorch backend ([#​16655](astral-sh/uv#16655)) - Fix Pixi environment detection ([#​16585](astral-sh/uv#16585)) ##### Documentation - Fix `CMD` path in FastAPI Dockerfile ([#​16701](astral-sh/uv#16701)) </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=-->
Resolves #16427
This PR updates
uv version --bumpso you can pin the exact number you’re targeting, i.e.--bump patch=10or--bump dev=42. The command-line interface now parses thosecomponent=valueflags, and the bump logic actually sets the version to the number you asked for.