我将如何使用bump2version
(关于它的调用和/或其配置)来增加:
1.0.0.a2.post0 # post-release of a pre-release a2
到
1.0.0.a3 # pre-release a3
可重现的例子:
$ python3 -m pip install 'bump2version==1.0.*'
__init__.py
:
__version__ = "1.0.0.a2.post0"
setup.cfg
:
[bumpversion]
current_version = 1.0.0.a2.post0
parse = ^
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+) # minimum major.minor.patch, 1.2.3
(?:
\.
(?P<prerel>a|alpha|b|beta|d|dev|rc) # pre-release segment
(?P<prerelversion>\d+) # pre-release version num
)?
(?:\.post(?P<post>\d+))? # post-release
serialize =
{major}.{minor}.{patch}.{prerel}{prerelversion}.post{post}
{major}.{minor}.{patch}.{prerel}{prerelversion}
{major}.{minor}.{patch}.post{post}
{major}.{minor}.{patch}
[bumpversion:file:__init__.py]
[bumpversion:part:prerel]
optional_value = dev
values =
dev
d
alpha
a
beta
b
rc
此方案的有效版本示例,它采用 PEP 440 中的一些但不是全部规则:
1.2.3 # (1) final
1.2.3.dev0 # (2) prerelease
1.2.3.a0
1.2.3.alpha0
1.2.3.b0
1.2.3.beta0
1.2.3.rc0
1.2.3.rc3.post0 # (3) postrelease (of a pre-release version)
1.2.3.post0 # (4) postrelease (of a final version)
例如,我已经尝试过,bump2version --verbose prerelversion
或者--new-version=1.0.0.a3
明确地尝试过。这两种尝试都保留.post0
而不是放弃它。
注意:几周前我在bump2version repo中将此作为一个使用问题问题提出来,但没有运气。