`incremental update --rc` treats rc0 as not being a release candidate
还没有人认领这个 Issue。
评估
调研方向
从 src/incremental/update.py 开始:if existing.release_candidate: 检查在 L105(--rc bump)、L156(完整发布路径)和 L180(重写现有 rc 引用)附近,对 rc0 而言全为 false。把它们改为 is not None 测试,并顺便检查 Version.__init__ 对 prerelease 的处理,在 src/incremental/_version.py 中。先运行 issue 中的复现以确认 30.6.0rc1,然后在 src/incremental/tests/test_update.py 中现有测试旁边添加一个回归测试;完成意味着 rc0 情况得到 24.1.0rc1 且测试套件通过。
由索引模型根据 Issue 内容生成。
描述
When the current version is a release candidate with number 0 (e.g. 24.1.0rc0), incremental update <pkg> --rc starts a new calendar version instead of bumping to rc1. With rc1 the bump works as documented.
Environment: incremental 24.11.0, Python 3.12
Reproduction (calls the function behind the CLI so the date is fixed; equivalent to incremental update Shrubbery --rc)
import datetime, json, pathlib, tempfile
from incremental.update import _run
result = []
for rc in [0, 1]:
with tempfile.TemporaryDirectory() as t:
p = pathlib.Path(t)
f = p / '_version.py'
f.write_text(
'from incremental import Version\n'
f'__version__ = Version("Shrubbery", 24, 1, 0, release_candidate={rc})\n'
)
_run('Shrubbery', str(p), None, False, True, False, False, False,
_date=datetime.date(2030, 6, 1), _print=lambda x: None)
ns = {}
exec(f.read_text(), ns)
result.append(ns['__version__'].public())
print(json.dumps(result))
Actual
["30.6.0rc1", "24.1.0rc2"]
Expected
["24.1.0rc1", "24.1.0rc2"]
The README says release_candidate can be "set to 0 or higher to mark this Version being of a release candidate", and that --rc will "bump the release candidate number by 1 if it is" one. An rc0 version can come from --newversion 24.1.0rc0 (or 24.1.0rc, which PEP 440 normalizes to rc0).
Likely cause: if existing.release_candidate: is false for 0. From reading the code, the same check is used for the no-argument "make a full release" path (L156) and when rewriting existing rc references (L180), so those probably mis-handle rc0 as well (I have not run them); is not None would fix all three. Version(..., prerelease=0) has a similar truthiness check in __init__, though that argument is deprecated.
Found while testing the library with an automated exploration tool; the reproduction above was re-run on 24.11.0 before filing.
- 主要语言
- Python
- 星标
- 145
- 派生
- 22
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
twisted/incremental 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 55/100
twisted/incremental#209 ·
-
[24.11.0] Incorrect Version and GIT Tag for 25.11.0?可能已有人在做 @twm 于 268 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 45/100
twisted/incremental#185 · 3 条评论 · 1 个 reaction ·
-
enhancement
难度 3/5 1-2 天 新手友好度 48/100
twisted/incremental#111 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
twisted/incremental#110 · 8 条评论 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 45/100
twisted/incremental#109 · 3 条评论 ·
查看 twisted/incremental 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
ActivityWatch/docs#223 ·
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier capture可能已有人在做 @jianyx1 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
volcengine/OpenViking#8354 ·
维护者通常 1 天内回复
-
comp/tools P2 tool/skills type/bug
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#159541 ·
维护者通常 1 天内回复
-
bot-triaged module: correctness (silent) module: cpu module: empty tensor module: loss triage review
难度 1/5 1 小时以内 新手友好度 80/100
维护者通常 1 天内回复
-
request-theme
难度 2/5 1-3 小时 新手友好度 62/100
LizardByte/ThemerrDB#10167 · 1 条评论 ·