Poetry has the version
command to increment a package version. Does uv package manager has anything similar?
Currently uv
package manager does not have a built-in command to bump package versions like poerty's version
command. you can manually pyproject.toml
or automate it with a script
for ex:
import toml
def bump_version(file_path, part="patch"):
with open(file_path, "r") as f:
pyproject = toml.load(f)
version = pyproject["tool"]["poetry"]["version"]
major, minor, patch = map(int, version.split("."))
if part == "major":
major += 1
minor = 0
patch = 0
elif part == "minor":
minor += 1
patch = 0
elif part == "patch":
patch += 1
pyproject["tool"]["poetry"]["version"] = f"{major}.{minor}.{patch}"
with open(file_path, "w") as f:
toml.dump(pyproject, f)
print(f"Version bumped to {major}.{minor}.{patch}")
Hope this helps.