peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 147 forks source link

Very simple use case not working. #189

Closed juanalot closed 6 years ago

juanalot commented 6 years ago

In the root of my repo I have a file named version. This file contains a semver string on line 1. That is all.

I expected the command bumpversion patch version to work. I do not want to use any cfg files. I simply expect the command to read the semver string, e.g. 2.0.38 and change it to 2.0.39.

Is this not the most basic use case? If the current version is already in the file why do I need to specify it? And by using something called 'bumpversion' one expects it to know how to calculate the new version. What am I missing?

Edit:

To be clear, I expected bumpversion patch version to do what I do in my own scripts/bump_version.py

import os
from os.path import pardir

import semver

here = os.path.abspath(os.path.dirname(__file__))

with io.open(os.path.join(here, pardir, 'version'), mode='r', encoding='utf-8') as f:
    version = f.read().strip()

with io.open(os.path.join(here, pardir, 'version'), mode='w', encoding='utf-8') as f:
    f.write(semver.bump_patch(version) + '\n')
peritus commented 6 years ago

Yes, makes sense. We have the same preferences wrt/ command line utilities.

Maybe you can use the --search and --replace flags to tell bumpversion to match the whole file. IIRC for parsing, bumping and serializing the defaults should match your semver use case.

juanalot commented 6 years ago

Thanks for the prompt reply. Wanted to remove our custom code to replace it with a one-liner in the build, but timebox ended.