This document outlines the workflow for creating pre-releases (Release Candidates) for User Acceptance Testing (UAT) and final releases using bump-my-version.
bump-my-version is included as a project dependency. Use uv to run it:
uv syncThe versioning configuration lives in pyproject.toml under [tool.bumpversion]. It handles release phases (dev, rc, final).
[tool.bumpversion]
current_version = "2.1.1"
commit = true
tag = true
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:(?P<release>[a-zA-Z]+)(?P<build>\\d+))?"
serialize = [
"{major}.{minor}.{patch}{release}{build}",
"{major}.{minor}.{patch}",
]
[[tool.bumpversion.files]]
filename = "pyproject.toml"
[tool.bumpversion.parts.release]
optional_value = "final"
values = ["dev", "rc", "final"]This workflow allows you to seamlessly transition from development builds to Release Candidates (RCs) for testing, and finally to production releases, without manually editing version strings.
When the dev branch is ready for User Acceptance Testing (UAT), cut a Release Candidate.
# This will update the version (e.g., from 2.1.1 to 2.1.2rc1), commit, and tag.
uv run bump-my-version bump patch --new-version 2.1.2rc1Push the commit and the new tag to GitHub:
git push origin dev --tagsWhat happens next?
If your GitHub Actions are configured to trigger on release tags, this will publish the 2.1.2rc1 version to PyPI as a pre-release.
How UAT testers install it:
Testers must explicitly request pre-releases using pip's --pre flag:
pip install --pre JayDeBeApiArrowIf UAT uncovers bugs, fix them on the dev branch, commit the fixes, and cut a new RC.
# This automatically bumps the build number (e.g., 2.1.2rc1 -> 2.1.2rc2), commits, and tags.
uv run bump-my-version bump buildPush the changes and the new tag:
git push origin dev --tagsOnce UAT is approved and the RC is confirmed stable:
- Merge the
devbranch intomain. - Checkout the
mainbranch. - Run the bump command to drop the
rcsuffix.
# This transitions the version from 'rc' to 'final' (which is the optional_value and omitted).
# Example: 2.1.2rc2 -> 2.1.2. It will commit and tag automatically.
uv run bump-my-version bump releasePush the final release to GitHub:
git push origin main --tagsThis will trigger the final production release to PyPI via GitHub Actions.