From 02fb847a29e30654d2605bef96bf9185546d7466 Mon Sep 17 00:00:00 2001 From: Jan10e Date: Sat, 21 Feb 2026 13:25:08 +0000 Subject: [PATCH 1/5] remove bumpversion.cfg --- .bumpversion.cfg | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 7f9e0b3..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[bumpversion] -current_version = 0.2.9 -commit = True -tag = False -tag_name = v{new_version} -sign_tags = False -message = "Upgrade: {current_version} → {new_version}" -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P[a-z]+)(?P\d+))? -serialize = - {major}.{minor}.{patch}.{release}{build} - {major}.{minor}.{patch} - -[bumpversion:part:release] -optional_value = rc -first_value = dev -values = - dev - rc - -[bumpversion:part:build] - -[bumpversion:file:pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" - -[bumpversion:file:README.md] -search = Version: "{current_version}" -replace = Version: "{new_version}" - -[bumpversion:file:templatepy/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" From 558f1b32dc9d20e34cb6afb8c0c32d407334f4d7 Mon Sep 17 00:00:00 2001 From: Jan10e Date: Sat, 21 Feb 2026 13:26:35 +0000 Subject: [PATCH 2/5] add bumpversion tool to .toml --- pyproject.toml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 677353d..adebf80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,4 +111,16 @@ convention = "numpy" [tool.mypy] warn_return_any = false -ignore_missing_imports = true \ No newline at end of file +ignore_missing_imports = true + +[tool.bumpversion] +current_version = "0.2.9" +commit = true +tag = true +tag_name = "v{new_version}" +message = "Bump version: {current_version} → {new_version}" + +[[tool.bumpversion.files]] +filename = "pyproject.toml" +search = "version = \"{current_version}\"" +replace = "version = \"{new_version}\"" From 504e019f80095166425c047fd2bae06089e4f69e Mon Sep 17 00:00:00 2001 From: Jan10e Date: Sat, 21 Feb 2026 13:35:56 +0000 Subject: [PATCH 3/5] update Readme and removed old reference to deleted bumpversion.cfg in toml --- README.md | 88 ++++++++++++++++++++++++++++++++++++++------------ pyproject.toml | 3 -- 2 files changed, 67 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c961274..cc44ca9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [packaging]: https://packaging.python.org/en/latest/tutorials/packaging-projects [setup.cfg]: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html -[bump2version]: (https://github.com/c4urself/bump2version +[bump-my-version]: https://github.com/callowayproject/bump-my-version [pre-commit]: https://pre-commit.com [//]: # ([black]: https://github.com/psf/black) @@ -189,8 +189,6 @@ The pipeline ensures code quality, passing tests, and automated deployment on ne - `.gitignore`: ignored files/folders in git tools -- `.bumpversion.cfg`: config for [bump2version] - ## TODO for **adapting** template to new project @@ -241,28 +239,73 @@ The pipeline ensures code quality, passing tests, and automated deployment on ne 3. **Create a New Release**: - On [GitHub](https://github.com/), create a new release manually via the **Releases** page. - Use a version number without a release extension (e.g., `x.y.z`). - - Alternatively, trigger the GitHub workflow configured for releasing by incrementing the version with `bump2version` (see info below) + - Alternatively, trigger the GitHub workflow configured for releasing by incrementing the version with `bump-my-version` (see info below) - Desperately, manually update the version strings in the relevant files and add git commit tag to trigger the release workflow on push The package will then be automatically uploaded to [PyPI](https://pypi.org/) or [Test PyPI](https://test.pypi.org/) as configured in your CI/CD workflow. -## Using `bump2version` for Versioning +## Using `bump-my-version` for Versioning + +`bump-my-version` is the modern, actively maintained tool for incrementing version numbers based on semantic versioning. + + ### Installation + + Already included in dev dependencies. To install manually: + ```bash + uv add --dev bump-my-version + ``` + + ### Configuration + + Version bumping is configured in `pyproject.toml` under `[tool.bumpversion]`: + - Specifies which files to update (e.g., `pyproject.toml`, `__init__.py`) + - Defines version format and parsing rules + - Controls Git tag settings and commit messages + + See the `[tool.bumpversion]` section in `pyproject.toml` for full configuration. -`bump2version` is used to increment version numbers based on semantic versioning. Here’s how you can use it with the current setup to trigger a release: + ### Bumping Versions + ```bash + # Bump patch version (e.g., from 1.2.3 to 1.2.4) + bump-my-version bump patch -1. **Bumping the Minor Version**: - Increment the minor version (e.g., from `v1.2.3` to `v1.3.0`): - ```bash - # Bumping the minor Version: - bump2version minor + # Bump minor version (e.g., from 1.2.3 to 1.3.0) + bump-my-version bump minor - # Bumping the major version (e.g., from v1.2.3 to v2.0.0): - bump2version major + # Bump major version (e.g., from 1.2.3 to 2.0.0) + bump-my-version bump major + + # Bump for a release version (e.g., from 1.0.0.dev0 to 1.0.0.rc1 or 1.0.0) + bump-my-version bump release + ``` + + ### Useful Commands + ```bash + # Show current version + bump-my-version show current_version + + # Preview changes without executing (dry run) + bump-my-version bump patch --dry-run --verbose + + # Show all configuration + bump-my-version show-bump + + # List all parts that can be bumped + bump-my-version show part + ``` + + ### What Happens When You Bump + + 1. ✅ Updates version in all configured files + 2. ✅ Creates a git commit with the change + 3. ✅ Creates a git tag (e.g., `v0.3.0`) + 4. ✅ Push the commit and tag to trigger release workflow + ```bash + # After bumping, push to remote + git push && git push --tags + ``` - # Bumping for a release Version (e.g., from v1.0.0.dev to v1.0.0.rc or v1.0.0): - bump2version release - ``` ## Workflows Summary @@ -379,12 +422,15 @@ Easily integrate GitHub CLI into workflows to perform repository tasks. See the ## Common issues -### `bump2version` fails on git tag with exit status 128 +### `bump-my-version` fails on git tag with exit status 128 + +Common reasons and solutions: -- check a signing key is configured: `git config --global user.signingkey` (see below for generating a key) -- repo is a detached HEAD? check out a branch: `git checkout main` -- there are changes that need to be committed? `git commit -am "commit message"` -- tag already exists? `git tag` to list tags, `git tag -d ` to delete a tag +- Signing key not configured: Check with `git config --global user.signingkey` (see below for setup) +- Detached HEAD: Check out a branch first: `git checkout main` +- Uncommitted changes: Commit your changes: `git commit -am "commit message"` +- Tag already exists: List tags with `git tag`, delete with `git tag -d ` +- No permission to push tags: Ensure you have push access to the repository ### No gpg key for signing commits - generate a key with `gpg --full-generate-key` diff --git a/pyproject.toml b/pyproject.toml index adebf80..f752f35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,9 +106,6 @@ docstring-code-line-length = "dynamic" [tool.ruff.lint.pydocstyle] convention = "numpy" -[tool.ruff.lint.per-file-ignores] -".bumpversion.cfg" = ["E501", "W291", "W292"] - [tool.mypy] warn_return_any = false ignore_missing_imports = true From 0e9c4a0f6b7b37b16db33ca10229181ee42f90df Mon Sep 17 00:00:00 2001 From: Jan10e Date: Sat, 21 Feb 2026 13:38:52 +0000 Subject: [PATCH 4/5] =?UTF-8?q?Bump=20version:=200.2.9=20=E2=86=92=200.2.1?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f752f35..b0d11e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "templatepy" -version = "0.2.9" +version = "0.2.10" authors = [ { name = "Lars B. Rollik", email = "L.B.Rollik@protonmail.com" } ] @@ -111,7 +111,7 @@ warn_return_any = false ignore_missing_imports = true [tool.bumpversion] -current_version = "0.2.9" +current_version = "0.2.10" commit = true tag = true tag_name = "v{new_version}" From 3b3e2f1372777463c28230ca657730706156c02d Mon Sep 17 00:00:00 2001 From: Jan10e Date: Sat, 21 Feb 2026 13:41:29 +0000 Subject: [PATCH 5/5] update Readme for terminal command to bump version with uv --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cc44ca9..24bc9df 100644 --- a/README.md +++ b/README.md @@ -268,16 +268,16 @@ The package will then be automatically uploaded to [PyPI](https://pypi.org/) or ### Bumping Versions ```bash # Bump patch version (e.g., from 1.2.3 to 1.2.4) - bump-my-version bump patch + uv run bump-my-version bump patch # Bump minor version (e.g., from 1.2.3 to 1.3.0) - bump-my-version bump minor + uv run bump-my-version bump minor # Bump major version (e.g., from 1.2.3 to 2.0.0) - bump-my-version bump major + uv run bump-my-version bump major # Bump for a release version (e.g., from 1.0.0.dev0 to 1.0.0.rc1 or 1.0.0) - bump-my-version bump release + uv run bump-my-version bump release ``` ### Useful Commands