c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 133 forks source link

Add an example of PEP-0440 versioning. #240

Open jorgeecardona opened 2 years ago

jorgeecardona commented 2 years ago

Hi, I expect most (some?) users of bump2version will push their packages to pypi and there is a recommendation of versioning in PEP-0440. It would be nice to have that in the documentation. It is more complex than the current default major.minor.patch, but I can imagine many of use wanting to have the more complex in PEP-0440.

For my purposes is enough to have this:

[bumpversion]
current_version = 0.1
tag = True
commit = True
parse = (?P<major>\d+)\.(?P<minor>\d+)((?P<release>a|b|rc)(?P<build>\d+))?
serialize = 
    {major}.{minor}{release}{build}
    {major}.{minor}
    {major}

[bumpversion:part:release]
optional_value = r
values = 
    a
    b
    rc
    r

[bumpversion:part:build]
first_value = 1

I can add this to the docs or improve on this, to have the full PEP-0440 scheme if people are willing to suggest improvements or find errors in my config (I haven't try all the corners but it seems to work as desired so far.)