mbarkhau/bumpver

Add support for defining multiple version patterns

9ao9ai9ar opened this issue · 2 comments

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.

Hi @9ao9ai9ar

Do you think this request has overlap with #220 ?

From the CLI/UX side, I think you're on the right track. The idea in the other issue was to have multiple files, which I think might be worse than what you're suggesting here.

Are you interested in working on this?

@mbarkhau I think both approaches can work, but multiple configs might suit his case better.

I no longer have a need for this feature, opting instead to not define any Python version-related field other than requires_python and just let the tools pick the one in the virtual environment, so no, I won't be interested in working on this.