{release} is not optional when defined manually
When defining a version_pattern
that contains {release}
it does not take it's optionality into account, which is different behaviour to {pycalver}
.
$ pycalver test "2019.06.0000-alpha" "{year}.{month}.{build_no}{release}"
New Version: 2019.06.0001-alpha
PEP440 : 2019.6.1a0
$ pycalver test "2019.06.0000" "{year}.{month}.{build_no}{release}"
ERROR - Invalid version string '2019.06.0000' for pattern '{year}.{month}.{build_no}{release}'/'(?P<year>\d{4})\.(?P<month>(?:0[0-9]|1[0-2]))\.(?P<build_no>\d{4,})(?P<release>-(?P<tag>(?:alpha|beta|dev|rc|post|final)))'
ERROR - Invalid version '2019.06.0000' and/or pattern '{year}.{month}.{build_no}{release}'.
I believe patterns.pyL81 should be:
r"(?:-{tag})?"
To match the same pattern that is used by {pycalver}
.
{release}
being mandatory breaks bump as the release tag is removed when updating to final:
$ pycalver test "2019.06.0000-alpha" "{year}.{month}.{build_no}{release}" --release=final
New Version: 2019.06.0001
PEP440 : 2019.6.1