Skip to content

Comments

Implement bump mechanism (mostly ported from rye)#7248

Closed
nrbnlulu wants to merge 15 commits intoastral-sh:mainfrom
nrbnlulu:nir/bump-version
Closed

Implement bump mechanism (mostly ported from rye)#7248
nrbnlulu wants to merge 15 commits intoastral-sh:mainfrom
nrbnlulu:nir/bump-version

Conversation

@nrbnlulu
Copy link

@nrbnlulu nrbnlulu commented Sep 10, 2024

Summary

Implement bump mechanism following major.minor.patch format.
fix #6298

I chose the bump name since version is already used though I would consider removing the current version handler for this

Test Plan

Simple idiomatic tests modifying the test pyprojec and checking the output statically

@nrbnlulu nrbnlulu marked this pull request as ready for review September 11, 2024 10:52
@nrbnlulu
Copy link
Author

windows test is failing though it seems more like a flaky test rather than something related to my changes...

@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Sep 11, 2024
@zanieb
Copy link
Member

zanieb commented Sep 15, 2024

I'll review this. We'll need to consider what version management interface we want in the long run.

@zanieb
Copy link
Member

zanieb commented Oct 6, 2024

I still haven't had time to decide if we want to replace uv version for this.

@nrbnlulu
Copy link
Author

nrbnlulu commented Oct 13, 2024

Is this PR wanted? should I resolve conflicts?

@n4z4m3
Copy link

n4z4m3 commented Nov 11, 2024

Is this PR wanted? should I resolve conflicts?

I would find this useful, but I see there has been no action on this for a while. Currently I use bump-my-version to do this, but it would be great to have it built into uv.

@nrbnlulu
Copy link
Author

yeah. the maintainers said they want to inspect other project \ alternative interfaces to have better context on this feature.
if someone is interested doing the research it would be cool.

@mthipparthi
Copy link

This is great feature and removes the dependency on bump version. This one along with change-log generation makes this tool complete.

@zanieb
Copy link
Member

zanieb commented Nov 27, 2024

I think about this pretty often, but I'm still not quite sure what to do, e.g., cargo version is not used for this purpose.

@Ephil012
Copy link

Out of curiosity, is there any timeline for this potentially getting merged? This is one of the main features I am missing from poetry

@Gankra
Copy link
Contributor

Gankra commented Mar 20, 2025

I've absorbed this work into #12349, thanks for all the work on this!

@Gankra Gankra closed this Mar 20, 2025
Gankra added a commit that referenced this pull request Apr 24, 2025
…edits (#12349)

This is a reimplementation of #7248 with a new CLI interface.

The old `uv version` is now `uv self version` (also it has gained a
`--short` flag for parity).
The new `uv version` is now an interface for getting/setting the project
version.

To give a modicum of support for migration, if `uv version` is run and
we fail to find/read a `pyproject.toml` we will fallback to `uv self
version`. `uv version --project .` prevents this fallback from being
allowed.

The new API of `uv version` is as follows:

* pass nothing to read the project version
* pass a version to set the project version
* `--bump major|minor|patch` to semver-bump the project version
* `--dry-run` to show the result but not apply it
* `--short` to have the final printout contain only the final version
* `--output-format json` to get the final printout as json

```
$ uv version
myfast 0.1.0

$ uv version --bump major --dry-run
myfast 0.1.0 => 1.0.0

$ uv version 1.2.3 --dry-run
myfast 0.1.0 => 1.2.3

$ uv version 1.2.3
myfast 0.1.0 => 1.2.3

$ uv version  --short 
1.2.3

$ uv version  --output-format json 
{
  "package_name": "myfast",
  "version": "1.2.3",
  "commit_info": null
}
```

Fixes #6298
zanieb pushed a commit that referenced this pull request Apr 29, 2025
…edits (#12349)

This is a reimplementation of #7248 with a new CLI interface.

The old `uv version` is now `uv self version` (also it has gained a
`--short` flag for parity).
The new `uv version` is now an interface for getting/setting the project
version.

To give a modicum of support for migration, if `uv version` is run and
we fail to find/read a `pyproject.toml` we will fallback to `uv self
version`. `uv version --project .` prevents this fallback from being
allowed.

The new API of `uv version` is as follows:

* pass nothing to read the project version
* pass a version to set the project version
* `--bump major|minor|patch` to semver-bump the project version
* `--dry-run` to show the result but not apply it
* `--short` to have the final printout contain only the final version
* `--output-format json` to get the final printout as json

```
$ uv version
myfast 0.1.0

$ uv version --bump major --dry-run
myfast 0.1.0 => 1.0.0

$ uv version 1.2.3 --dry-run
myfast 0.1.0 => 1.2.3

$ uv version 1.2.3
myfast 0.1.0 => 1.2.3

$ uv version  --short
1.2.3

$ uv version  --output-format json
{
  "package_name": "myfast",
  "version": "1.2.3",
  "commit_info": null
}
```

Fixes #6298
zanieb pushed a commit that referenced this pull request Apr 29, 2025
…edits (#12349)

This is a reimplementation of #7248 with a new CLI interface.

The old `uv version` is now `uv self version` (also it has gained a
`--short` flag for parity).
The new `uv version` is now an interface for getting/setting the project
version.

To give a modicum of support for migration, if `uv version` is run and
we fail to find/read a `pyproject.toml` we will fallback to `uv self
version`. `uv version --project .` prevents this fallback from being
allowed.

The new API of `uv version` is as follows:

* pass nothing to read the project version
* pass a version to set the project version
* `--bump major|minor|patch` to semver-bump the project version
* `--dry-run` to show the result but not apply it
* `--short` to have the final printout contain only the final version
* `--output-format json` to get the final printout as json

```
$ uv version
myfast 0.1.0

$ uv version --bump major --dry-run
myfast 0.1.0 => 1.0.0

$ uv version 1.2.3 --dry-run
myfast 0.1.0 => 1.2.3

$ uv version 1.2.3
myfast 0.1.0 => 1.2.3

$ uv version  --short
1.2.3

$ uv version  --output-format json
{
  "package_name": "myfast",
  "version": "1.2.3",
  "commit_info": null
}
```

Fixes #6298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a command to read and update (i.e., bump) the project version, e.g., uv version

8 participants