Open florisla opened 5 years ago
yep, let's do this -- I've run into this myself
I can work on this. Note that we would have to change [part]
from a mandatory to an optional argument (#22).
Would you prefer the approach from #31 or #51 to accomplish this?
Would you prefer the approach from #31 or #51 to accomplish this?
Any thoughts on this?
I've found that changing the behaviour of bumpversion.cli.main
is very tough because it's so huge, with many different things going on.
I have a branch in the works that extracts all of that into helper methods; I'm going to work on that first.
Getting the next version would be great! Currently doing
bump2version minor --dry-run --list | grep new_version | awk -f= '{print $2}'
I can work on this. Note that we would have to change
[part]
from a mandatory to an optional argument (#22).Would you prefer the approach from #31 or #51 to accomplish this?
How about adding subcommands. So it would be:
bump2version bump minor
bump2version show
Any progress on this feature? Would we see this feature in the next release?
No progress yet. I'll look into it again, but can't make promises.
Is there anything I can do to achieve this feature in the next release? any help or contribution?
You've just motivated me to try to implement it this Christmas holiday :-)
@kkpattern I like the idea of subcommands, but that's hard to achieve in a backwards-compatible way.
For this feature I feel like it's not worth the hassle.
I think making part
optional is a good way to go. The --new-version
option could be refactored so that if part
is given and not major/minor/patch, and can be interpreted as a version string, which is used as the new version (the old option could remain for compatibility purposes, possibly with a PendingDeprecationWarning).
The --show
option without a part
would show the current version. If a part was given, the --show
option would prevent the actual update, and just show the version string if it were to be updated.
If part
is not given, and no options are given which know how to behave without a part, the help message should be shown. I believe unix tools prefer to not throw errors when no arguments are given, so there's another gain there.
--show major
could also be interpreted as "show me the current major
part" (do not bump).
On the other hand, you could also achieve that using --show --serialize "{major}"
Let's just implement --show
and folks can reuse --serialize
if they really must. In general I'd prefer the Unix philosophy and not try to stuff too many things into bump2version. Ex:| cut -d'.' -f1
for major is completely fine with just --show
... again I understand Windows may not have this but I'm sure folks can figure out how to do this without the "everything and the kitchen sink" approach.
@florisla Hello! It's useful feature for me. Do you have estimation for it ?
Sorry it's slow. I have a working branch but each time I want to make a pull request I'm not sure all the code in there is necessary or understandable.
I'll aim for end of February for the pull request.
The lack of this feature has also slowed me down as well, so I've gone ahead and put up a quick pull request. Happy to merge in the changes from your working branch @florisla, but I tried to keep it minimal.
@florisla @c4urself Any thoughts on the PR I've put up?
For other folks that are blocked, I've moved forward with defaulting to using the dependency management and packaging tool's to gather the current_version
information: https://python-poetry.org/docs/cli/#version
For the record, this feature is going to be implemented in the new bump-my-version
object. See: https://github.com/callowayproject/bump-my-version/issues/15
External tools currently have to use
grep
andsed
to extract the version number from the output ofbump2version --list
.This is long and not very readable. Worse yet, Windows doesn't offer
grep
orsed
unless you install Cygwin/GnuWin32/Linux subsystem for Windows[/...] .Because it's a common need, I'd like to see (and can contribute) this instead:
I would propose that
show
enforcesdry-run
behavior so it never touches physical files. If you want to physically bump the version and also show it, you simply have to call bump2version two times.