bump2v 1.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bump2v-1.7.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mr Nachos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ # Local upstream clone (gitignored); never ship it.
2
+ prune bump2version
bump2v-1.7.0/PKG-INFO ADDED
@@ -0,0 +1,506 @@
1
+ Metadata-Version: 2.4
2
+ Name: bump2v
3
+ Version: 1.7.0
4
+ Summary: This is a package to bump version numbers in a project. Fully automated versioning. Refer to bump2version package instructions.
5
+ License: MIT License
6
+
7
+ Copyright (c) 2024 Mr Nachos
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Homepage, https://github.com/maimul/bump2v
28
+ Keywords: alternative,version,versioning,bump2version,automate,python,deployment,devops,dev,ops,automation,bump,versioning
29
+ Classifier: Programming Language :: Python :: 3
30
+ Classifier: Programming Language :: Python :: 3 :: Only
31
+ Classifier: Programming Language :: Python :: 3.11
32
+ Classifier: Programming Language :: Python :: 3.12
33
+ Classifier: Programming Language :: Python :: 3.13
34
+ Classifier: Programming Language :: Python :: 3.14
35
+ Classifier: Programming Language :: Python :: 3.15
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Environment :: Console
39
+ Classifier: Topic :: Software Development :: Build Tools
40
+ Classifier: Topic :: Software Development :: Version Control :: Git
41
+ Requires-Python: >=3.11
42
+ Description-Content-Type: text/x-rst
43
+ License-File: LICENSE
44
+ Provides-Extra: test
45
+ Requires-Dist: pytest; extra == "test"
46
+ Dynamic: license-file
47
+
48
+ bump2v
49
+ ======
50
+
51
+ A CLI wrapper and native fork of `bump2version <https://github.com/c4urself/bump2version>`_ for automated semantic versioning. Bumps version numbers across files, commits, tags, and pushes -- all in one command.
52
+
53
+ .. code-block:: zsh
54
+
55
+ pip install bump2v # or: pipx install bump2v
56
+
57
+ Requires Python 3.11 or newer (older Pythons get 1.6.x). No other dependencies.
58
+
59
+ -----------
60
+
61
+ How it works
62
+ ------------
63
+
64
+ bump2v reads your current version from a config file, increments it, rewrites it in every file you specify, commits the change, creates a git tag, and pushes -- all in one command. The **source of truth for the version** lives in your project's main file:
65
+
66
+ - **Node.js / React / JS** -- ``package.json`` -> ``"version": "1.0.0"``
67
+ - **Python** -- ``appInfo.py`` -> ``__version__ = "1.0.0"``
68
+ - **Any other file** -- configurable via ``.bumpversion.cfg``
69
+
70
+ The ``.bumpversion.cfg`` file tells bump2v where to find and update that version string. **You only need to run bump2v -- never edit the version manually.**
71
+
72
+ -----------
73
+
74
+ Quick Start
75
+ -----------
76
+
77
+ **Once per project:** let bump2v find your version and write ``.bumpversion.cfg``, then review and commit it.
78
+
79
+ .. code-block:: zsh
80
+
81
+ bump2v init
82
+
83
+ **Step 1:** Make your code change.
84
+
85
+ **Step 2:** Stage and commit.
86
+
87
+ .. code-block:: zsh
88
+
89
+ git add .
90
+ git commit -m "fix: describe your change here"
91
+
92
+ **Step 3:** Bump the version and push.
93
+
94
+ .. code-block:: zsh
95
+
96
+ bump2v patch # 1.0.0 -> 1.0.1 (bug fix)
97
+ bump2v minor # 1.0.0 -> 1.1.0 (new feature)
98
+ bump2v major # 1.0.0 -> 2.0.0 (breaking change)
99
+ bump2v auto # detect level from commit messages automatically
100
+
101
+ Alternative command aliases: ``bumptydumpty``, ``versionkaboom``
102
+
103
+ Preview first
104
+ ~~~~~~~~~~~~~
105
+
106
+ .. code-block:: zsh
107
+
108
+ bump2v plan patch # new version, files, commit message, tag, push; changes nothing
109
+ bump2v plan auto --json # the same as JSON, for scripts and AI agents
110
+ bump2v patch --dry-run # the older form; also changes nothing (--verbose shows each file)
111
+
112
+ bump2v pushes only what the run itself created. With ``--dry-run``, ``--no-commit`` or ``commit = False`` there is nothing new, so nothing is pushed.
113
+
114
+ -----------
115
+
116
+ Commands
117
+ --------
118
+
119
+ - ``bump2v <part>`` -- bump, commit, tag and push. ``<part>`` is ``major``, ``minor``, ``patch`` or a part from your config
120
+ - ``bump2v auto`` -- the same, with the part picked from your commit messages (see Auto mode below)
121
+ - ``bump2v release <part|auto>`` -- the same as ``bump2v <part>``, named explicitly
122
+ - ``bump2v plan <part|auto>`` -- show what a bump would do. Changes nothing
123
+ - ``bump2v show [field ...]`` -- print ``current_version``, ``files``, ``tag_name``, ``next.major``, ``next.minor``, ``next.patch``, ...
124
+ - ``bump2v check`` -- fail with exit code 4 if a configured file doesn't contain ``current_version``
125
+ - ``bump2v init [--agents]`` -- write ``.bumpversion.cfg`` for this project. ``--agents`` also adds release instructions for AI coding agents
126
+
127
+ Options for every command: ``--json`` (one JSON result on stdout), ``--no-push``, ``--push``. ``bump2v <part> --help`` lists every bumpversion option (``--config-file``, ``--allow-dirty``, ``--no-commit``, ``--no-tag``, ``--new-version``, ...).
128
+
129
+ If your config defines a part named ``release``, ``bump2v release`` on its own still bumps that part; ``bump2v release patch`` is the command.
130
+
131
+ -----------
132
+
133
+ Setup by project type
134
+ ---------------------
135
+
136
+ Node.js / React
137
+ ~~~~~~~~~~~~~~~
138
+
139
+ The version lives in ``package.json``. bump2v finds and updates it there.
140
+
141
+ ``.bumpversion.cfg``:
142
+
143
+ .. code-block:: ini
144
+
145
+ [bumpversion]
146
+ current_version = 1.0.0
147
+ commit = True
148
+ tag = True
149
+ message = Version Updated: {current_version} -> {new_version} [skip ci]
150
+
151
+ [bumpversion:file:package.json]
152
+ search = "version": "{current_version}"
153
+ replace = "version": "{new_version}"
154
+
155
+ The ``current_version`` in ``.bumpversion.cfg`` must always match the ``"version"`` field in ``package.json``. bump2v keeps them in sync automatically -- never edit either one by hand.
156
+
157
+ Python
158
+ ~~~~~~
159
+
160
+ The version lives in ``appInfo.py`` (or wherever you store your app metadata).
161
+
162
+ ``app/appInfo.py``:
163
+
164
+ .. code-block:: python
165
+
166
+ app_name = "Your App Name"
167
+ __version__ = "1.0.0"
168
+ description = "Describe your app here"
169
+
170
+ ``main.py``:
171
+
172
+ .. code-block:: python
173
+
174
+ from appInfo import __version__, app_name, description
175
+
176
+ app = FastAPI(
177
+ title=app_name,
178
+ description=description,
179
+ version=__version__,
180
+ )
181
+
182
+ ``.bumpversion.cfg``:
183
+
184
+ .. code-block:: ini
185
+
186
+ [bumpversion]
187
+ current_version = 1.0.0
188
+ commit = True
189
+ tag = True
190
+ message = Version Updated: {current_version} -> {new_version} [skip ci]
191
+
192
+ [bumpversion:file:app/appInfo.py]
193
+ search = __version__ = "{current_version}"
194
+ replace = __version__ = "{new_version}"
195
+
196
+ Multiple files
197
+ ~~~~~~~~~~~~~~
198
+
199
+ You can target as many files as needed:
200
+
201
+ .. code-block:: ini
202
+
203
+ [bumpversion]
204
+ current_version = 1.0.0
205
+ commit = True
206
+ tag = True
207
+
208
+ [bumpversion:file:package.json]
209
+ search = "version": "{current_version}"
210
+ replace = "version": "{new_version}"
211
+
212
+ [bumpversion:file:app/appInfo.py]
213
+ search = __version__ = "{current_version}"
214
+ replace = __version__ = "{new_version}"
215
+
216
+ -----------
217
+
218
+ Semantic Versioning
219
+ -------------------
220
+
221
+ - ``bump2v patch`` -- ``1.0.0 -> 1.0.1`` -- Bug fixes, minor improvements
222
+ - ``bump2v minor`` -- ``1.0.0 -> 1.1.0`` -- New backward-compatible features
223
+ - ``bump2v major`` -- ``1.0.0 -> 2.0.0`` -- Breaking changes
224
+ - ``bump2v auto`` -- Detect level automatically from commit messages
225
+
226
+ -----------
227
+
228
+ Auto mode (Conventional Commits)
229
+ ---------------------------------
230
+
231
+ ``bump2v auto`` analyzes every commit since the last release using the
232
+ `Conventional Commits <https://www.conventionalcommits.org>`_ spec and
233
+ selects the bump level automatically. The last release is the newest tag your
234
+ ``tag_name`` could have made (``baseline-v{new_version}`` -> tags matching
235
+ ``baseline-v*``), or, with ``tag = False``, the last commit whose subject
236
+ matches your ``message``. No more guessing whether this week's
237
+ work is a patch or a minor.
238
+
239
+ **Rules:**
240
+
241
+ - ``feat!:`` or ``BREAKING CHANGE:`` in commit footer -> major
242
+ - ``feat:`` -> minor
243
+ - ``fix:``, ``perf:``, ``refactor:``, ``chore:``, ``docs:``, etc. -> patch
244
+ - Scopes are supported: ``feat(auth):`` counts as ``feat``
245
+ - The **highest** level found across all commits wins
246
+
247
+ **Example output:**
248
+
249
+ .. code-block:: zsh
250
+
251
+ $ bump2v auto
252
+ Analyzing commits since v1.5.3...
253
+
254
+ feat: add websocket endpoint minor
255
+ fix: handle null pointer in auth module patch
256
+ chore: update dependencies patch
257
+ feat!: redesign configuration API MAJOR
258
+
259
+ Auto-detected: major
260
+ Bumping to version: 2.0.0
261
+
262
+ If no conventional commits are found, bumps patch as a safe fallback.
263
+ With no earlier release it bumps patch. With nothing new since the last
264
+ release it stops with exit code 7. In CI, check out the full history
265
+ (``fetch-depth: 0`` in GitHub Actions); a shallow clone that hides the last
266
+ release fails with exit code 1 instead of guessing. Preview with
267
+ ``bump2v plan auto``.
268
+
269
+ -----------
270
+
271
+ In CI pipelines
272
+ ---------------
273
+
274
+ .. code-block:: yaml
275
+
276
+ - uses: actions/checkout@v6
277
+ with:
278
+ fetch-depth: 0 # auto reads the commits since the last tag
279
+ - name: Bump, tag and push
280
+ id: bump
281
+ run: |
282
+ pip install "bump2v>=1.7,<2"
283
+ bump2v release auto
284
+ echo "version=$(bump2v show current_version)" >> "$GITHUB_OUTPUT"
285
+
286
+ - Pin a version range (``bump2v>=1.7,<2``) so a new major release can't change your pipeline.
287
+ - When git has no user set and ``CI`` is set, bump2v commits as ``github-actions[bot]`` on GitHub Actions (or ``bump2v`` elsewhere), so no ``git config`` step is needed.
288
+ - ``bump2v show current_version`` prints just the version; no need to grep the config.
289
+ - ``bump2v release auto --json`` returns the old and new version, files, commit SHA, tag and push result in one object.
290
+ - ``--no-push`` commits and tags without pushing, for jobs that push later or not at all.
291
+ - Pushes made with ``GITHUB_TOKEN`` don't start new workflow runs, so the version commit won't trigger the pipeline again. Use a ``concurrency`` group so two releases never race.
292
+ - bump2v stops before writing anything if the new tag already exists (exit 5), and keeps the commit and tag local if HEAD is detached (exit 6).
293
+
294
+ -----------
295
+
296
+ Using with AI coding agents
297
+ ---------------------------
298
+
299
+ .. code-block:: zsh
300
+
301
+ bump2v init --agents
302
+
303
+ adds a **Releasing** section to ``CLAUDE.md`` (or ``AGENTS.md``) that tells Claude Code, Codex, Cursor and other agents to preview with ``bump2v plan auto --json``, release with ``bump2v release auto``, check with ``bump2v check``, and never edit versions by hand.
304
+
305
+ To let an agent preview freely but ask before it releases, in Claude Code's ``.claude/settings.json``:
306
+
307
+ .. code-block:: json
308
+
309
+ {
310
+ "permissions": {
311
+ "allow": ["Bash(bump2v plan *)", "Bash(bump2v show *)", "Bash(bump2v check *)"],
312
+ "ask": ["Bash(bump2v release *)"]
313
+ }
314
+ }
315
+
316
+ Output is plain text (no emoji) when it isn't going to a terminal, or when ``NO_COLOR``, ``CI`` or ``CLAUDECODE`` is set.
317
+
318
+ -----------
319
+
320
+ Exit codes and JSON output
321
+ --------------------------
322
+
323
+ - ``0`` -- done
324
+ - ``1`` -- other error
325
+ - ``2`` -- bad arguments or config
326
+ - ``3`` -- working tree has uncommitted changes
327
+ - ``4`` -- a configured file doesn't contain the current version
328
+ - ``5`` -- the new tag already exists
329
+ - ``6`` -- push failed (or HEAD is detached); the commit and tag are local
330
+ - ``7`` -- nothing to release
331
+
332
+ With ``--json``, stdout carries one object (abbreviated here) and messages stay on stderr:
333
+
334
+ .. code-block:: json
335
+
336
+ {
337
+ "format_version": "1.0",
338
+ "command": "plan",
339
+ "ok": true,
340
+ "current_version": "1.2.3",
341
+ "new_version": "1.3.0",
342
+ "part": "minor",
343
+ "files": [{"path": "package.json", "changed": true, "matches": 1}],
344
+ "commit": {"enabled": true, "message": "Version Updated: 1.2.3 -> 1.3.0", "sha": null},
345
+ "tag": {"enabled": true, "name": "v1.3.0", "created": false},
346
+ "push": {"enabled": true, "pushed": false}
347
+ }
348
+
349
+ On failure: ``"ok": false``, ``"exit_code"``, and ``"error": {"code", "message", "hint", "retryable"}``. ``format_version`` changes minor for added fields and major for removed or renamed ones.
350
+
351
+ -----------
352
+
353
+ Advanced Flags
354
+ --------------
355
+
356
+ ``--no-push`` / ``push = False`` -- Commit and tag without pushing
357
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
358
+
359
+ .. code-block:: zsh
360
+
361
+ bump2v patch --no-push
362
+
363
+ Or set ``push = False`` in ``[bumpversion]``; ``--push`` overrides it for one run.
364
+
365
+ ``replace_all`` -- Bump only the first match
366
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
367
+
368
+ By default every match of ``search`` in a file is replaced. If the same version string appears elsewhere (a dependency pinned to the same version), bump only the first match:
369
+
370
+ .. code-block:: ini
371
+
372
+ [bumpversion:file:pyproject.toml]
373
+ search = version = "{current_version}"
374
+ replace = version = "{new_version}"
375
+ replace_all = False
376
+
377
+ ``bump2v plan`` warns when a search matches more than once. ``bump2v init`` sets ``replace_all = False`` for ``pyproject.toml`` and ``Cargo.toml``.
378
+
379
+ ``--tag-only`` -- Tag without bumping
380
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381
+
382
+ Tags the current HEAD using ``current_version`` from config, without bumping or committing. Useful when you need to commit a build artifact between the version bump commit and the release tag.
383
+
384
+ .. code-block:: zsh
385
+
386
+ bump2v patch --no-tag # bump + commit, skip the tag
387
+ # ... build artifact, git add, git commit ...
388
+ bumpversion --tag-only # tag HEAD now
389
+
390
+ Fixes `#256 <https://github.com/c4urself/bump2version/issues/256>`_.
391
+
392
+ ``--ignore-missing-version`` -- Skip files without a version string
393
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394
+
395
+ When using glob patterns, some files may not contain the version string. Instead of crashing, bump2v logs a warning and skips those files.
396
+
397
+ .. code-block:: zsh
398
+
399
+ bump2v patch --ignore-missing-version
400
+
401
+ Or set it permanently in config:
402
+
403
+ .. code-block:: ini
404
+
405
+ [bumpversion]
406
+ ignore_missing_version = True
407
+
408
+ Fixes `#267 <https://github.com/c4urself/bump2version/issues/267>`_.
409
+
410
+ ``--extra-files`` -- Include generated files in the bump commit
411
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412
+
413
+ Stage additional files alongside the version bump commit, even if not modified by bumpversion. Files can be dirty or untracked.
414
+
415
+ .. code-block:: zsh
416
+
417
+ bump2v patch --extra-files docs/changelog.md dist/summary.txt
418
+
419
+ Or set them in config:
420
+
421
+ .. code-block:: ini
422
+
423
+ [bumpversion]
424
+ extra_files = docs/changelog.md dist/summary.txt
425
+
426
+ Fixes `#259 <https://github.com/c4urself/bump2version/issues/259>`_.
427
+
428
+ ``sign_tags`` config fix
429
+ ~~~~~~~~~~~~~~~~~~~~~~~~
430
+
431
+ Setting ``sign_tags = False`` in ``.bumpversion.cfg`` now works correctly. Previously it was silently ignored, causing GPG signing attempts to fail.
432
+
433
+ .. code-block:: ini
434
+
435
+ [bumpversion]
436
+ sign_tags = False
437
+
438
+ Fixes `#269 <https://github.com/c4urself/bump2version/issues/269>`_.
439
+
440
+ -----------
441
+
442
+ Full Config Reference
443
+ ---------------------
444
+
445
+ .. code-block:: ini
446
+
447
+ [bumpversion]
448
+ current_version = 1.0.0
449
+ commit = True
450
+ tag = True
451
+ sign_tags = False
452
+ message = Version Updated: {current_version} -> {new_version} [skip ci]
453
+ tag_name = v{new_version}
454
+ tag_message = Release {new_version}
455
+ commit_args =
456
+ ignore_missing_version = False
457
+ extra_files =
458
+ push = True # False: commit and tag, but don't push
459
+ replace_all = True # False: bump only the first match in each file
460
+ allow_dirty = False
461
+
462
+ [bumpversion:file:package.json]
463
+ search = "version": "{current_version}"
464
+ replace = "version": "{new_version}"
465
+
466
+ bump2v looks for its config in this order and uses the first it finds: ``--config-file``, ``$BUMP2V_CONFIG``, ``.bumpversion.cfg``, ``.bumpversion.toml``, ``pyproject.toml`` with a ``[tool.bumpversion]`` table, ``setup.cfg``.
467
+
468
+ TOML config
469
+ ~~~~~~~~~~~
470
+
471
+ ``.bumpversion.toml`` and ``pyproject.toml`` use the ``[tool.bumpversion]`` table (the same format as bump-my-version):
472
+
473
+ .. code-block:: toml
474
+
475
+ [tool.bumpversion]
476
+ current_version = "1.0.0"
477
+ commit = true
478
+ tag = true
479
+
480
+ [[tool.bumpversion.files]]
481
+ filename = "pyproject.toml"
482
+ search = 'version = "{current_version}"'
483
+ replace = 'version = "{new_version}"'
484
+ replace_all = false
485
+
486
+ bump2v updates ``current_version`` by editing that one line, so comments and formatting stay. Options it doesn't support (hooks, ``regex``, ...) are reported and ignored.
487
+
488
+ -----------
489
+
490
+ Tips
491
+ ----
492
+
493
+ Remove all local tags if you need to reset:
494
+
495
+ .. code-block:: zsh
496
+
497
+ git tag -l | xargs -n 1 git tag -d
498
+
499
+ -----------
500
+
501
+ Contributors
502
+ ------------
503
+
504
+ Maintained and extended by `@maimul <https://github.com/maimul>`_.
505
+
506
+ Built on top of `bump2version <https://github.com/c4urself/bump2version>`_ by Christian Verkerk.