vrzn 0.1.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.
- vrzn-0.1.0/LICENSE +21 -0
- vrzn-0.1.0/PKG-INFO +251 -0
- vrzn-0.1.0/README.md +221 -0
- vrzn-0.1.0/pyproject.toml +120 -0
- vrzn-0.1.0/requirements.txt +2 -0
- vrzn-0.1.0/setup.cfg +4 -0
- vrzn-0.1.0/setup.py +7 -0
- vrzn-0.1.0/tests/test_cli.py +136 -0
- vrzn-0.1.0/tests/test_config.py +160 -0
- vrzn-0.1.0/tests/test_locations.py +221 -0
- vrzn-0.1.0/tests/test_presets.py +187 -0
- vrzn-0.1.0/tests/test_version.py +277 -0
- vrzn-0.1.0/vrzn/__init__.py +1 -0
- vrzn-0.1.0/vrzn/cli.py +327 -0
- vrzn-0.1.0/vrzn/config.py +136 -0
- vrzn-0.1.0/vrzn/locations.py +165 -0
- vrzn-0.1.0/vrzn/presets.py +129 -0
- vrzn-0.1.0/vrzn/version.py +242 -0
- vrzn-0.1.0/vrzn.egg-info/PKG-INFO +251 -0
- vrzn-0.1.0/vrzn.egg-info/SOURCES.txt +22 -0
- vrzn-0.1.0/vrzn.egg-info/dependency_links.txt +1 -0
- vrzn-0.1.0/vrzn.egg-info/entry_points.txt +2 -0
- vrzn-0.1.0/vrzn.egg-info/requires.txt +17 -0
- vrzn-0.1.0/vrzn.egg-info/top_level.txt +1 -0
vrzn-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Scott Arne Johnson
|
|
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.
|
vrzn-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vrzn
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Language-agnostic version management across project files
|
|
5
|
+
Author-email: Scott Arne Johnson <scott.arne.johnson@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: version,versioning,pep440,semver,cli
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: rich-click>=1.8
|
|
17
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
18
|
+
Provides-Extra: yaml
|
|
19
|
+
Requires-Dist: pyyaml>=6.0; extra == "yaml"
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: invoke; extra == "dev"
|
|
22
|
+
Requires-Dist: build; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
25
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
26
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pyyaml>=6.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# vrzn
|
|
32
|
+
|
|
33
|
+
**Author:** Scott Arne Johnson ([scott.arne.johnson@gmail.com](mailto:scott.arne.johnson@gmail.com))
|
|
34
|
+
|
|
35
|
+
Language-agnostic version management across project files.
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
Projects often store version numbers in multiple files: `pyproject.toml`, `__init__.py`, `CMakeLists.txt`, `package.json`, and others. When these fall out of sync, builds break and releases ship incorrect metadata.
|
|
40
|
+
|
|
41
|
+
vrzn solves this by letting you declare every file that contains a version number in a single configuration file. It can then read, set, and bump versions across all of them at once, with full [PEP 440](https://peps.python.org/pep-0440/) support.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
Requires Python 3.10 or later.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install vrzn
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For YAML config file support:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install 'vrzn[yaml]'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
Create a `vrzn.toml` in your project root:
|
|
60
|
+
|
|
61
|
+
```toml
|
|
62
|
+
[[locations]]
|
|
63
|
+
file = "pyproject.toml"
|
|
64
|
+
type = "pyproject-version"
|
|
65
|
+
|
|
66
|
+
[[locations]]
|
|
67
|
+
file = "src/mypackage/__init__.py"
|
|
68
|
+
type = "python-dunder"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Check that all version locations are in sync:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
$ vrzn get
|
|
75
|
+
|
|
76
|
+
vrzn — version report
|
|
77
|
+
╭───────────────────────────┬───────────────────┬─────────┬────────╮
|
|
78
|
+
│ File │ Location │ Version │ Status │
|
|
79
|
+
├───────────────────────────┼───────────────────┼─────────┼────────┤
|
|
80
|
+
│ pyproject.toml │ pyproject-version │ 1.0.0 │ ok │
|
|
81
|
+
├───────────────────────────┼───────────────────┼─────────┼────────┤
|
|
82
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.0.0 │ ok │
|
|
83
|
+
╰───────────────────────────┴───────────────────┴─────────┴────────╯
|
|
84
|
+
|
|
85
|
+
Consensus version: 1.0.0
|
|
86
|
+
All version numbers are consistent.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Set a specific version everywhere:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
$ vrzn -y set 1.2.0
|
|
93
|
+
|
|
94
|
+
Setting version to 1.2.0
|
|
95
|
+
|
|
96
|
+
updated files
|
|
97
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬─────────╮
|
|
98
|
+
│ File │ Location │ Current │ New │ Result │
|
|
99
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼─────────┤
|
|
100
|
+
│ pyproject.toml │ pyproject-version │ 1.0.0 │ 1.2.0 │ updated │
|
|
101
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.0.0 │ 1.2.0 │ updated │
|
|
102
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴─────────╯
|
|
103
|
+
|
|
104
|
+
All versions set to 1.2.0.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Bump the version:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
$ vrzn -y bump patch
|
|
111
|
+
|
|
112
|
+
Version bump: 1.2.0 → 1.2.1
|
|
113
|
+
|
|
114
|
+
updated files
|
|
115
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬─────────╮
|
|
116
|
+
│ File │ Location │ Current │ New │ Result │
|
|
117
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼─────────┤
|
|
118
|
+
│ pyproject.toml │ pyproject-version │ 1.2.0 │ 1.2.1 │ updated │
|
|
119
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.2.0 │ 1.2.1 │ updated │
|
|
120
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴─────────╯
|
|
121
|
+
|
|
122
|
+
Version bumped to 1.2.1.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Preview changes without writing files:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
$ vrzn --dry-run bump minor
|
|
129
|
+
|
|
130
|
+
Version bump: 1.2.1 → 1.3.0
|
|
131
|
+
|
|
132
|
+
dry run
|
|
133
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬──────────────╮
|
|
134
|
+
│ File │ Location │ Current │ New │ Result │
|
|
135
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼──────────────┤
|
|
136
|
+
│ pyproject.toml │ pyproject-version │ 1.2.1 │ 1.3.0 │ would update │
|
|
137
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.2.1 │ 1.3.0 │ would update │
|
|
138
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴──────────────╯
|
|
139
|
+
|
|
140
|
+
Dry run — no files were modified.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Pre-release workflows:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
vrzn -y bump patch --pre rc # 1.0.0 -> 1.0.1rc1
|
|
147
|
+
vrzn -y bump pre # 1.0.1rc1 -> 1.0.1rc2
|
|
148
|
+
vrzn -y bump release # 1.0.1rc2 -> 1.0.1
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## CLI Reference
|
|
152
|
+
|
|
153
|
+
### Global Options
|
|
154
|
+
|
|
155
|
+
Global options must be placed before the subcommand (e.g., `vrzn --dry-run bump patch`).
|
|
156
|
+
|
|
157
|
+
| Option | Description |
|
|
158
|
+
|--------|-------------|
|
|
159
|
+
| `--dry-run` | Show what would change without writing files. |
|
|
160
|
+
| `--yes`, `-y` | Skip confirmation prompts. |
|
|
161
|
+
| `--quiet`, `-q` | Machine-readable output, no tables. |
|
|
162
|
+
| `--config`, `-c PATH` | Path to config file (overrides discovery). |
|
|
163
|
+
|
|
164
|
+
### Commands
|
|
165
|
+
|
|
166
|
+
#### `vrzn get`
|
|
167
|
+
|
|
168
|
+
Display the current version in all configured files. Prints a table showing each location, its version, and whether it matches the consensus.
|
|
169
|
+
|
|
170
|
+
With `--quiet`, prints only the consensus version string.
|
|
171
|
+
|
|
172
|
+
**Exit codes:** `0` if all versions agree, `1` if mismatches exist, `2` if no config found.
|
|
173
|
+
|
|
174
|
+
#### `vrzn set VERSION`
|
|
175
|
+
|
|
176
|
+
Set all version numbers to VERSION. Accepts any PEP 440 version string (e.g., `1.0.0`, `1.0.0rc1`, `1.0.0.post1`). Non-normalized forms are accepted and automatically normalized.
|
|
177
|
+
|
|
178
|
+
Prompts for confirmation unless `--yes` or `--dry-run` is set.
|
|
179
|
+
|
|
180
|
+
**Exit codes:** `1` for invalid version format, `2` if no config found.
|
|
181
|
+
|
|
182
|
+
#### `vrzn bump PART [--pre LABEL]`
|
|
183
|
+
|
|
184
|
+
Bump the version number. PART must be one of: `major`, `minor`, `patch`, `pre`, `release`.
|
|
185
|
+
|
|
186
|
+
Use `--pre` with a label (`alpha`, `a`, `beta`, `b`, `rc`) to enter a pre-release state. Use `bump pre` to increment an existing pre-release. Use `bump release` to finalize a pre-release to its stable version.
|
|
187
|
+
|
|
188
|
+
If versions are out of sync, vrzn warns and uses a consensus version (most common across locations). Prompts for confirmation unless `--yes` or `--dry-run` is set.
|
|
189
|
+
|
|
190
|
+
**Exit codes:** `1` for errors (no readable version, invalid bump operation), `2` if no config found.
|
|
191
|
+
|
|
192
|
+
## Configuration
|
|
193
|
+
|
|
194
|
+
vrzn searches up the directory tree for config in this order:
|
|
195
|
+
|
|
196
|
+
1. `vrzn.toml`
|
|
197
|
+
2. `vrzn.yaml`
|
|
198
|
+
3. `vrzn.json`
|
|
199
|
+
4. `pyproject.toml` (under `[tool.vrzn]`)
|
|
200
|
+
|
|
201
|
+
### Built-in Presets
|
|
202
|
+
|
|
203
|
+
| Preset | Matches | `base_only` |
|
|
204
|
+
|--------|---------|:-----------:|
|
|
205
|
+
| `pyproject-version` | `version = "X.Y.Z"` in TOML | no |
|
|
206
|
+
| `python-dunder` | `__version__ = "X.Y.Z"` | no |
|
|
207
|
+
| `python-version-info` | `__version_info__ = (X, Y, Z)` | yes |
|
|
208
|
+
| `cmake-project` | `project(NAME VERSION X.Y.Z)` | yes |
|
|
209
|
+
| `c-define` | `#define PREFIX_VERSION_MAJOR N` | yes |
|
|
210
|
+
| `cargo-toml` | `version = "X.Y.Z"` in Cargo.toml | no |
|
|
211
|
+
| `package-json` | `"version": "X.Y.Z"` in JSON | no |
|
|
212
|
+
| `maven-pom` | `<version>X.Y.Z</version>` | no |
|
|
213
|
+
| `gradle-version` | `version = 'X.Y.Z'` in Gradle | no |
|
|
214
|
+
|
|
215
|
+
Presets marked `base_only` write only the `MAJOR.MINOR.PATCH` portion, ignoring pre-release or post-release suffixes.
|
|
216
|
+
|
|
217
|
+
The `c-define` preset requires a `prefix` parameter:
|
|
218
|
+
|
|
219
|
+
```toml
|
|
220
|
+
[[locations]]
|
|
221
|
+
file = "include/mylib.h"
|
|
222
|
+
type = "c-define"
|
|
223
|
+
prefix = "MYLIB"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Custom Locations
|
|
227
|
+
|
|
228
|
+
For files that don't match a built-in preset, use `custom` with explicit regex patterns:
|
|
229
|
+
|
|
230
|
+
```toml
|
|
231
|
+
[[locations]]
|
|
232
|
+
file = "docs/conf.py"
|
|
233
|
+
type = "custom"
|
|
234
|
+
label = "Sphinx config"
|
|
235
|
+
pattern = '(release\s*=\s*")[^"]+"'
|
|
236
|
+
replacement = '\g<1>{version}"'
|
|
237
|
+
extract = 'release\s*=\s*"([^"]+)"'
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Replacement format variables: `{version}`, `{major}`, `{minor}`, `{patch}`, `{info_tuple}`.
|
|
241
|
+
|
|
242
|
+
## Development
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pip install --config-settings editable_mode=compat -e ".[dev,yaml]"
|
|
246
|
+
pytest
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
MIT License. Copyright (c) 2026 Scott Arne Johnson. See [LICENSE](LICENSE) for details.
|
vrzn-0.1.0/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# vrzn
|
|
2
|
+
|
|
3
|
+
**Author:** Scott Arne Johnson ([scott.arne.johnson@gmail.com](mailto:scott.arne.johnson@gmail.com))
|
|
4
|
+
|
|
5
|
+
Language-agnostic version management across project files.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Projects often store version numbers in multiple files: `pyproject.toml`, `__init__.py`, `CMakeLists.txt`, `package.json`, and others. When these fall out of sync, builds break and releases ship incorrect metadata.
|
|
10
|
+
|
|
11
|
+
vrzn solves this by letting you declare every file that contains a version number in a single configuration file. It can then read, set, and bump versions across all of them at once, with full [PEP 440](https://peps.python.org/pep-0440/) support.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Requires Python 3.10 or later.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install vrzn
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For YAML config file support:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install 'vrzn[yaml]'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
Create a `vrzn.toml` in your project root:
|
|
30
|
+
|
|
31
|
+
```toml
|
|
32
|
+
[[locations]]
|
|
33
|
+
file = "pyproject.toml"
|
|
34
|
+
type = "pyproject-version"
|
|
35
|
+
|
|
36
|
+
[[locations]]
|
|
37
|
+
file = "src/mypackage/__init__.py"
|
|
38
|
+
type = "python-dunder"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Check that all version locations are in sync:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ vrzn get
|
|
45
|
+
|
|
46
|
+
vrzn — version report
|
|
47
|
+
╭───────────────────────────┬───────────────────┬─────────┬────────╮
|
|
48
|
+
│ File │ Location │ Version │ Status │
|
|
49
|
+
├───────────────────────────┼───────────────────┼─────────┼────────┤
|
|
50
|
+
│ pyproject.toml │ pyproject-version │ 1.0.0 │ ok │
|
|
51
|
+
├───────────────────────────┼───────────────────┼─────────┼────────┤
|
|
52
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.0.0 │ ok │
|
|
53
|
+
╰───────────────────────────┴───────────────────┴─────────┴────────╯
|
|
54
|
+
|
|
55
|
+
Consensus version: 1.0.0
|
|
56
|
+
All version numbers are consistent.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Set a specific version everywhere:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
$ vrzn -y set 1.2.0
|
|
63
|
+
|
|
64
|
+
Setting version to 1.2.0
|
|
65
|
+
|
|
66
|
+
updated files
|
|
67
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬─────────╮
|
|
68
|
+
│ File │ Location │ Current │ New │ Result │
|
|
69
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼─────────┤
|
|
70
|
+
│ pyproject.toml │ pyproject-version │ 1.0.0 │ 1.2.0 │ updated │
|
|
71
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.0.0 │ 1.2.0 │ updated │
|
|
72
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴─────────╯
|
|
73
|
+
|
|
74
|
+
All versions set to 1.2.0.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Bump the version:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
$ vrzn -y bump patch
|
|
81
|
+
|
|
82
|
+
Version bump: 1.2.0 → 1.2.1
|
|
83
|
+
|
|
84
|
+
updated files
|
|
85
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬─────────╮
|
|
86
|
+
│ File │ Location │ Current │ New │ Result │
|
|
87
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼─────────┤
|
|
88
|
+
│ pyproject.toml │ pyproject-version │ 1.2.0 │ 1.2.1 │ updated │
|
|
89
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.2.0 │ 1.2.1 │ updated │
|
|
90
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴─────────╯
|
|
91
|
+
|
|
92
|
+
Version bumped to 1.2.1.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Preview changes without writing files:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
$ vrzn --dry-run bump minor
|
|
99
|
+
|
|
100
|
+
Version bump: 1.2.1 → 1.3.0
|
|
101
|
+
|
|
102
|
+
dry run
|
|
103
|
+
╭───────────────────────────┬───────────────────┬─────────┬───────┬──────────────╮
|
|
104
|
+
│ File │ Location │ Current │ New │ Result │
|
|
105
|
+
├───────────────────────────┼───────────────────┼─────────┼───────┼──────────────┤
|
|
106
|
+
│ pyproject.toml │ pyproject-version │ 1.2.1 │ 1.3.0 │ would update │
|
|
107
|
+
│ src/mypackage/__init__.py │ python-dunder │ 1.2.1 │ 1.3.0 │ would update │
|
|
108
|
+
╰───────────────────────────┴───────────────────┴─────────┴───────┴──────────────╯
|
|
109
|
+
|
|
110
|
+
Dry run — no files were modified.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Pre-release workflows:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
vrzn -y bump patch --pre rc # 1.0.0 -> 1.0.1rc1
|
|
117
|
+
vrzn -y bump pre # 1.0.1rc1 -> 1.0.1rc2
|
|
118
|
+
vrzn -y bump release # 1.0.1rc2 -> 1.0.1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## CLI Reference
|
|
122
|
+
|
|
123
|
+
### Global Options
|
|
124
|
+
|
|
125
|
+
Global options must be placed before the subcommand (e.g., `vrzn --dry-run bump patch`).
|
|
126
|
+
|
|
127
|
+
| Option | Description |
|
|
128
|
+
|--------|-------------|
|
|
129
|
+
| `--dry-run` | Show what would change without writing files. |
|
|
130
|
+
| `--yes`, `-y` | Skip confirmation prompts. |
|
|
131
|
+
| `--quiet`, `-q` | Machine-readable output, no tables. |
|
|
132
|
+
| `--config`, `-c PATH` | Path to config file (overrides discovery). |
|
|
133
|
+
|
|
134
|
+
### Commands
|
|
135
|
+
|
|
136
|
+
#### `vrzn get`
|
|
137
|
+
|
|
138
|
+
Display the current version in all configured files. Prints a table showing each location, its version, and whether it matches the consensus.
|
|
139
|
+
|
|
140
|
+
With `--quiet`, prints only the consensus version string.
|
|
141
|
+
|
|
142
|
+
**Exit codes:** `0` if all versions agree, `1` if mismatches exist, `2` if no config found.
|
|
143
|
+
|
|
144
|
+
#### `vrzn set VERSION`
|
|
145
|
+
|
|
146
|
+
Set all version numbers to VERSION. Accepts any PEP 440 version string (e.g., `1.0.0`, `1.0.0rc1`, `1.0.0.post1`). Non-normalized forms are accepted and automatically normalized.
|
|
147
|
+
|
|
148
|
+
Prompts for confirmation unless `--yes` or `--dry-run` is set.
|
|
149
|
+
|
|
150
|
+
**Exit codes:** `1` for invalid version format, `2` if no config found.
|
|
151
|
+
|
|
152
|
+
#### `vrzn bump PART [--pre LABEL]`
|
|
153
|
+
|
|
154
|
+
Bump the version number. PART must be one of: `major`, `minor`, `patch`, `pre`, `release`.
|
|
155
|
+
|
|
156
|
+
Use `--pre` with a label (`alpha`, `a`, `beta`, `b`, `rc`) to enter a pre-release state. Use `bump pre` to increment an existing pre-release. Use `bump release` to finalize a pre-release to its stable version.
|
|
157
|
+
|
|
158
|
+
If versions are out of sync, vrzn warns and uses a consensus version (most common across locations). Prompts for confirmation unless `--yes` or `--dry-run` is set.
|
|
159
|
+
|
|
160
|
+
**Exit codes:** `1` for errors (no readable version, invalid bump operation), `2` if no config found.
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
vrzn searches up the directory tree for config in this order:
|
|
165
|
+
|
|
166
|
+
1. `vrzn.toml`
|
|
167
|
+
2. `vrzn.yaml`
|
|
168
|
+
3. `vrzn.json`
|
|
169
|
+
4. `pyproject.toml` (under `[tool.vrzn]`)
|
|
170
|
+
|
|
171
|
+
### Built-in Presets
|
|
172
|
+
|
|
173
|
+
| Preset | Matches | `base_only` |
|
|
174
|
+
|--------|---------|:-----------:|
|
|
175
|
+
| `pyproject-version` | `version = "X.Y.Z"` in TOML | no |
|
|
176
|
+
| `python-dunder` | `__version__ = "X.Y.Z"` | no |
|
|
177
|
+
| `python-version-info` | `__version_info__ = (X, Y, Z)` | yes |
|
|
178
|
+
| `cmake-project` | `project(NAME VERSION X.Y.Z)` | yes |
|
|
179
|
+
| `c-define` | `#define PREFIX_VERSION_MAJOR N` | yes |
|
|
180
|
+
| `cargo-toml` | `version = "X.Y.Z"` in Cargo.toml | no |
|
|
181
|
+
| `package-json` | `"version": "X.Y.Z"` in JSON | no |
|
|
182
|
+
| `maven-pom` | `<version>X.Y.Z</version>` | no |
|
|
183
|
+
| `gradle-version` | `version = 'X.Y.Z'` in Gradle | no |
|
|
184
|
+
|
|
185
|
+
Presets marked `base_only` write only the `MAJOR.MINOR.PATCH` portion, ignoring pre-release or post-release suffixes.
|
|
186
|
+
|
|
187
|
+
The `c-define` preset requires a `prefix` parameter:
|
|
188
|
+
|
|
189
|
+
```toml
|
|
190
|
+
[[locations]]
|
|
191
|
+
file = "include/mylib.h"
|
|
192
|
+
type = "c-define"
|
|
193
|
+
prefix = "MYLIB"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Custom Locations
|
|
197
|
+
|
|
198
|
+
For files that don't match a built-in preset, use `custom` with explicit regex patterns:
|
|
199
|
+
|
|
200
|
+
```toml
|
|
201
|
+
[[locations]]
|
|
202
|
+
file = "docs/conf.py"
|
|
203
|
+
type = "custom"
|
|
204
|
+
label = "Sphinx config"
|
|
205
|
+
pattern = '(release\s*=\s*")[^"]+"'
|
|
206
|
+
replacement = '\g<1>{version}"'
|
|
207
|
+
extract = 'release\s*=\s*"([^"]+)"'
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Replacement format variables: `{version}`, `{major}`, `{minor}`, `{patch}`, `{info_tuple}`.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pip install --config-settings editable_mode=compat -e ".[dev,yaml]"
|
|
216
|
+
pytest
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
MIT License. Copyright (c) 2026 Scott Arne Johnson. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Packaging configuration file for vrzn
|
|
2
|
+
# ----------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
# Guide: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
4
|
+
# Spec: https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
5
|
+
#
|
|
6
|
+
# Note: The pyproject.toml spec is still being adopted by many tools and IDEs. For this reason, please place your
|
|
7
|
+
# requirements in the requirements.txt file. This spec is written to dynamically use those dependencies.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Choosing a build backend:
|
|
11
|
+
# https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["setuptools"]
|
|
14
|
+
build-backend = "setuptools.build_meta"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
[project]
|
|
18
|
+
name = "vrzn"
|
|
19
|
+
dynamic = ["version", "dependencies"]
|
|
20
|
+
description = "Language-agnostic version management across project files"
|
|
21
|
+
readme = "README.md"
|
|
22
|
+
requires-python = ">=3.10"
|
|
23
|
+
license = "MIT"
|
|
24
|
+
keywords = ["version", "versioning", "pep440", "semver", "cli"]
|
|
25
|
+
authors = [
|
|
26
|
+
{name = "Scott Arne Johnson", email = "scott.arne.johnson@gmail.com" }
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 4 - Beta",
|
|
30
|
+
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Topic :: Software Development :: Build Tools",
|
|
33
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
yaml = ["pyyaml>=6.0"]
|
|
38
|
+
dev = ["invoke", "build", "pytest>=7.0", "pytest-cov", "pre-commit>=3.0", "ruff>=0.1.0", "mypy>=1.0", "pyyaml>=6.0"]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
vrzn = "vrzn.cli:main"
|
|
42
|
+
|
|
43
|
+
# ----------------------------------------------------------------------------------------
|
|
44
|
+
# These configurations are specific to the `setuptools` build backend
|
|
45
|
+
# ----------------------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.packages.find]
|
|
48
|
+
|
|
49
|
+
# Indicate the name of our package
|
|
50
|
+
include = ["vrzn*"]
|
|
51
|
+
|
|
52
|
+
# Exclude any test directory
|
|
53
|
+
exclude = ["*test*"]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.dynamic]
|
|
57
|
+
|
|
58
|
+
# Get the version from a "single source of truth"
|
|
59
|
+
version = {attr = "vrzn.__version__"}
|
|
60
|
+
|
|
61
|
+
# Package dependencies (these will be installed by pip)
|
|
62
|
+
# https://packaging.python.org/discussions/install-requires-vs-requirements/
|
|
63
|
+
dependencies = {file = ["requirements.txt"]}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# ----------------------------------------------------------------------------------------
|
|
67
|
+
# Ruff configuration (linting and formatting)
|
|
68
|
+
# https://docs.astral.sh/ruff/configuration/
|
|
69
|
+
# ----------------------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 120
|
|
73
|
+
target-version = "py310"
|
|
74
|
+
|
|
75
|
+
[tool.ruff.lint]
|
|
76
|
+
select = [
|
|
77
|
+
"E", # pycodestyle errors
|
|
78
|
+
"F", # pyflakes
|
|
79
|
+
"W", # pycodestyle warnings
|
|
80
|
+
"I", # isort
|
|
81
|
+
"UP", # pyupgrade
|
|
82
|
+
"B", # flake8-bugbear
|
|
83
|
+
"SIM", # flake8-simplify
|
|
84
|
+
]
|
|
85
|
+
ignore = [
|
|
86
|
+
"E501", # Line too long (handled by formatter)
|
|
87
|
+
"B008", # Function call in default argument
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint.isort]
|
|
91
|
+
known-first-party = ["vrzn"]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ----------------------------------------------------------------------------------------
|
|
95
|
+
# MyPy configuration (type checking)
|
|
96
|
+
# https://mypy.readthedocs.io/en/stable/config_file.html
|
|
97
|
+
# ----------------------------------------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
[tool.mypy]
|
|
100
|
+
python_version = "3.10"
|
|
101
|
+
warn_return_any = true
|
|
102
|
+
warn_unused_ignores = true
|
|
103
|
+
ignore_missing_imports = true
|
|
104
|
+
exclude = ["tests/", "build/", "dist/"]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# ----------------------------------------------------------------------------------------
|
|
108
|
+
# Pytest configuration
|
|
109
|
+
# https://docs.pytest.org/en/stable/reference/customize.html
|
|
110
|
+
# ----------------------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
[tool.pytest.ini_options]
|
|
113
|
+
testpaths = ["tests"]
|
|
114
|
+
markers = [
|
|
115
|
+
"integration: marks tests as integration tests (deselect with '-m not integration')",
|
|
116
|
+
"slow: marks tests as slow (deselect with '-m not slow')",
|
|
117
|
+
]
|
|
118
|
+
filterwarnings = [
|
|
119
|
+
"ignore::DeprecationWarning:importlib._bootstrap",
|
|
120
|
+
]
|
vrzn-0.1.0/setup.cfg
ADDED
vrzn-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
# This file is here for compatibility: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
|
|
3
|
+
# Please put all configuration into pyproject.toml
|
|
4
|
+
# ----------------------------------------------------------------------------------------------------------------------
|
|
5
|
+
from setuptools import setup
|
|
6
|
+
|
|
7
|
+
setup()
|