Poetry has the version command to increment a package version. Does the uv package manager have anything similar?
This feature has been introduced with the release of uv 0.7.0. Especially, uv version now can be used to inspect and bump a project's version.
Show current version.
$ uv version
stack-example 1.2.3
Bump patch / minor / major version.
$ uv version --bump patch
stack-example 1.2.3 => 1.2.4
$ uv version --bump minor
stack-example 1.2.4 => 1.3.0
$ uv version --bump major
stack-example 1.3.0 => 2.0.0
Show version of uv itself (previously by running uv version).
$ uv self version
uv 0.7.1 (90f46f89a 2025-04-30)
EDIT: Since uv 0.7.0 there is a uv version command, explained above.
I do this:
# Replace with your version
VERSION="0.5.0"
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION
If you need to retrieve:
uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version
Works in a Dockerfile, makefile, etc.
If you need to bump the version by using specifiers like patch, minor, or major:
v=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)
# Bump patch version
part="patch"
uvx --from bump2version bumpversion --allow-dirty --current-version "$v" "$part" pyproject.toml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With