`incremental update --rc` treats rc0 as not being a release candidate
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start in src/incremental/update.py: the if existing.release_candidate: checks around L105 (--rc bump), L156 (full-release path) and L180 (rewriting existing rc references) are all false for rc0. Change them to an is not None test, and check Version.__init__'s prerelease handling in src/incremental/_version.py while you are there. Run the reproduction from the issue first to confirm 30.6.0rc1, then add a regression test alongside the existing ones in src/incremental/tests/test_update.py; done means the rc0 case yields 24.1.0rc1 and the suite passes.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 145
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from twisted/incremental
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
twisted/incremental#209 ·
-
[24.11.0] Incorrect Version and GIT Tag for 25.11.0?Possibly taken @twm claimed this 267 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
twisted/incremental#185 · 3 comments · 1 reaction ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
twisted/incremental#111 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
twisted/incremental#110 · 8 comments ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
twisted/incremental#109 · 3 comments ·
All issues in twisted/incremental
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OpenFreeEnergy/openfe#2371 ·
Maintainers usually reply within 2 days
-
HMDB's smiles file writes "None" for metabolites with an empty <smiles/> (file not currently used)Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
NCATSTranslator/Babel#1269 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Half a day Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
404 on sample dataOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
bcgov/nr-hydrometric-rating-curve#443 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100