11# bumper
2- [ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/sco1-bumper/1 .0.0?logo=python&logoColor=FFD43B )] ( https://pypi.org/project/sco1-bumper/ )
2+ [ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/sco1-bumper/2 .0.0?logo=python&logoColor=FFD43B )] ( https://pypi.org/project/sco1-bumper/ )
33[ ![ PyPI] ( https://img.shields.io/pypi/v/sco1-bumper?logo=Python&logoColor=FFD43B )] ( https://pypi.org/project/sco1-bumper/ )
44[ ![ PyPI - License] ( https://img.shields.io/pypi/l/sco1-bumper?color=magenta )] ( https://github.com/sco1/bumper/blob/main/LICENSE )
55[ ![ pre-commit.ci status] ( https://results.pre-commit.ci/badge/github/sco1/bumper/main.svg )] ( https://results.pre-commit.ci/latest/github/sco1/bumper/main )
@@ -8,6 +8,12 @@ Automatically increment the project's version number.
88
99Heavily inspired by [ ` bump2version ` ] ( https://github.com/c4urself/bump2version ) and [ ` bumpversion ` ] ( https://github.com/peritus/bumpversion ) . While [ ` bump-my-version ` ] ( https://github.com/callowayproject/bump-my-version ) is an excellent modern fork this functionality, I'd like a pared down version of the offered feature set for my personal projects.
1010
11+ ## Supported Versioning Schemes
12+ * [ Semantic Versioning (SemVer)] ( https://semver.org/#semantic-versioning-200 )
13+ * Assumes ` <MAJOR>.<MINOR>.<PATCH> `
14+ * [ Calendar Versioning (CalVer)] ( https://calver.org/ )
15+ * Assumes ` <YYYY>.<0M>.<MICRO> `
16+
1117## Installation
1218Install from PyPi with your favorite ` pip ` invocation, e.g.:
1319
@@ -21,10 +27,10 @@ import cog
2127from subprocess import PIPE, run
2228out = run(["bumper", "--help"], stdout=PIPE, encoding="ascii")
2329cog.out(
24- f"```bash \n$ bumper --help\n{out.stdout.rstrip()}\n```"
30+ f"```\n$ bumper --help\n{out.stdout.rstrip()}\n```"
2531)
2632]]] -->
27- ``` bash
33+ ```
2834$ bumper --help
2935Usage: bumper [OPTIONS] COMMAND [ARGS]...
3036
@@ -42,7 +48,7 @@ Commands:
4248### Required Fields
4349#### ` tool.bumper `
4450* ` current_version ` - The current software version. This is automatically incremented when bumping.
45- * ** NOTE: ** Only SemVer is supported
51+ * ` versioning_type ` - Versioning type to be used, accepted values are ` "semver" ` and ` "calver" `
4652
4753#### ` tool.bumper.files `
4854* ` file ` - Path to target file relative to the repository root
@@ -51,9 +57,22 @@ Commands:
5157### Example Configuration
5258The basic configuration looks something like the following:
5359
60+ #### SemVer
5461``` toml
5562[tool .bumper ]
5663current_version = " 0.1.0"
64+ versioning_type = " semver"
65+
66+ [[tool .bumper .files ]]
67+ file = " ./pyproject.toml"
68+ search = ' version = "{current_version}"'
69+ ```
70+
71+ #### CalVer
72+ ``` toml
73+ [tool .bumper ]
74+ current_version = " 2025.01.0"
75+ versioning_type = " calver"
5776
5877[[tool .bumper .files ]]
5978file = " ./pyproject.toml"
@@ -65,6 +84,7 @@ Multiple replacements within the same file can also be specified:
6584``` toml
6685[tool .bumper ]
6786current_version = " 0.1.0"
87+ versioning_type = " semver"
6888
6989[[tool .bumper .files ]]
7090file = " ./pyproject.toml"
@@ -88,20 +108,29 @@ import cog
88108from subprocess import PIPE, run
89109out = run(["bumper", "bump", "--help"], stdout=PIPE, encoding="ascii")
90110cog.out(
91- f"```bash \n$ bumper bump --help\n{out.stdout.rstrip()}\n```"
111+ f"```\n$ bumper bump --help\n{out.stdout.rstrip()}\n```"
92112)
93113]]] -->
94- ``` bash
114+ ```
95115$ bumper bump --help
96- Usage: bumper bump [OPTIONS] BUMP_BY:{major| minor| patch}
116+ Usage: bumper bump [OPTIONS] BUMP_BY:{major|minor|patch|date }
97117
98118 Bump the requested version component.
99119
120+ Allowable `BUMP_BY` values differ based on the project's specified
121+ versioning type: SemVer - (major, minor, patch), CalVer - (date)
122+
123+ When using CalVer, if the user's current UTC month is the same as the
124+ current project version, then the Micro component is incremented. Otherwise,
125+ the date components are bumped to the user's current UTC month and Micro
126+ reset to `0`.
127+
100128 If `dry_run` is `True`, the requested diff will be displayed in the terminal
101129 & no file modifications will take place.
102130
103131Arguments:
104- BUMP_BY:{major| minor| patch} [required]
132+ BUMP_BY:{major|minor|patch|date}
133+ [required]
105134
106135Options:
107136 --dry-run / --no-dry-run Preview the requested diff. [default: no-dry-run]
@@ -112,17 +141,17 @@ Options:
112141### ` bumper init `
113142A small helper to initialize a starter ` .bumper.toml ` file that bumps the ` version ` field of your project's ` pyproject.toml ` file.
114143
115- ** NOTE:** This starter file is initialized at version ` 0.1.0 ` , so be sure to update this value with your current version number before using bumper.
144+ ** NOTE:** Be sure to update the sample version with your current version number before bumping with bumper.
116145
117146<!-- [[[cog
118147import cog
119148from subprocess import PIPE, run
120149out = run(["bumper", "init", "--help"], stdout=PIPE, encoding="ascii")
121150cog.out(
122- f"```bash \n$ bumper init --help\n{out.stdout.rstrip()}\n```"
151+ f"```\n$ bumper init --help\n{out.stdout.rstrip()}\n```"
123152)
124153]]] -->
125- ``` bash
154+ ```
126155$ bumper init --help
127156Usage: bumper init [OPTIONS]
128157
@@ -133,6 +162,8 @@ Usage: bumper init [OPTIONS]
133162 configuration will be preserved.
134163
135164Options:
165+ --versioning-type [semver|calver]
166+ [default: semver]
136167 --ignore-existing / --no-ignore-existing
137168 [default: no-ignore-existing]
138169 --help Show this message and exit.
0 commit comments