bumpver
bumpver copied to clipboard
Add support for defining multiple version patterns
My use case is bumping the project version and the minimum-supported Python version (because each tool likes to define their own fields for this) strings inside pyproject.toml
. Say we're allowed to write this in pyproject.toml
:
[tool.bumpver.project]
current_version = "2024.07.11"
version_pattern = "YYYY.0M.0D[-PATCH]"
bumpver_flags = "--patch"
file_patterns = {
"pyproject.toml" = [
'version = "{version}"',
]
}
[tool.bumpver.python]
current_version = "3.10"
version_pattern = "MAJOR.MINOR"
bumpver_flags = "--minor"
file_patterns = {
"pyproject.toml" = [
'^pythonVersion = "{version}"',
'^python-version = "{version}"',
'^target-python-version = "{version}"',
]
}
and update the versions via specifying the subtable key:
> bumpver update project
> bumpver update python
It'll be a huge UX improvement.