semversioner 2.2.0__tar.gz → 3.0.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.
Files changed (31) hide show
  1. {semversioner-2.2.0 → semversioner-3.0.0}/LICENSE +1 -1
  2. semversioner-3.0.0/PKG-INFO +252 -0
  3. semversioner-3.0.0/README.md +198 -0
  4. semversioner-3.0.0/pyproject.toml +69 -0
  5. semversioner-3.0.0/semversioner/__init__.py +14 -0
  6. semversioner-3.0.0/semversioner/__version__.py +1 -0
  7. semversioner-3.0.0/semversioner/cli.py +169 -0
  8. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner/core.py +38 -32
  9. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner/models.py +17 -12
  10. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner/storage.py +68 -72
  11. semversioner-3.0.0/semversioner.egg-info/PKG-INFO +252 -0
  12. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner.egg-info/SOURCES.txt +2 -7
  13. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner.egg-info/entry_points.txt +0 -1
  14. semversioner-3.0.0/semversioner.egg-info/requires.txt +9 -0
  15. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner.egg-info/top_level.txt +0 -1
  16. semversioner-3.0.0/setup.cfg +4 -0
  17. semversioner-2.2.0/CHANGELOG.md +0 -209
  18. semversioner-2.2.0/MANIFEST.in +0 -4
  19. semversioner-2.2.0/PKG-INFO +0 -378
  20. semversioner-2.2.0/README.md +0 -140
  21. semversioner-2.2.0/requirements.txt +0 -3
  22. semversioner-2.2.0/semversioner/__init__.py +0 -4
  23. semversioner-2.2.0/semversioner/__version__.py +0 -1
  24. semversioner-2.2.0/semversioner/cli.py +0 -151
  25. semversioner-2.2.0/semversioner.egg-info/PKG-INFO +0 -378
  26. semversioner-2.2.0/semversioner.egg-info/requires.txt +0 -3
  27. semversioner-2.2.0/setup.cfg +0 -10
  28. semversioner-2.2.0/setup.py +0 -112
  29. semversioner-2.2.0/tests/resources/__init__.py +0 -0
  30. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner/__main__.py +0 -0
  31. {semversioner-2.2.0 → semversioner-3.0.0}/semversioner.egg-info/dependency_links.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Raul Gomis
3
+ Copyright (c) 2020-2026 Raul Gomis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: semversioner
3
+ Version: 3.0.0
4
+ Summary: Manage properly semver in your repository
5
+ Author-email: Raul Gomis <raulgomis@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2020-2026 Raul Gomis
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/raulgomis/semversioner
29
+ Classifier: Development Status :: 5 - Production/Stable
30
+ Classifier: Environment :: Console
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: Intended Audience :: End Users/Desktop
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
40
+ Classifier: Programming Language :: Python :: 3.14
41
+ Classifier: Operating System :: OS Independent
42
+ Requires-Python: >=3.10
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: click>=8.0.0
46
+ Requires-Dist: jinja2>=3.0.0
47
+ Requires-Dist: packaging>=21.0
48
+ Provides-Extra: dev
49
+ Requires-Dist: pytest>=9.0.0; extra == "dev"
50
+ Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
51
+ Requires-Dist: importlib_resources>=6.0.0; extra == "dev"
52
+ Requires-Dist: ruff>=0.9.0; extra == "dev"
53
+ Dynamic: license-file
54
+
55
+ # Semversioner
56
+
57
+ The easiest way to manage [semantic versioning](https://semver.org/) in your project and generate `CHANGELOG.md` files automatically.
58
+
59
+ Semversioner provides the tooling to automate the semver release process for libraries, docker images, microservices, and more.
60
+
61
+ This project was inspired by the way AWS manages their versioning for [AWS-cli](https://github.com/aws/aws-cli/).
62
+
63
+ [![PyPI Version](https://img.shields.io/pypi/v/semversioner.svg)](https://pypi.org/project/semversioner/)
64
+
65
+ ## Semantic Versioning
66
+
67
+ The [semantic versioning](https://semver.org/) spec involves several possible variations, but to simplify, in _Semversioner_ we are using the three-part version number:
68
+
69
+ `<major>.<minor>.<patch>`
70
+
71
+ Constructed with the following guidelines:
72
+
73
+ - Breaking backward compatibility or major features bumps the **major** (and resets the minor and patch).
74
+ - New additions without breaking backward compatibility bumps the **minor** (and resets the patch).
75
+ - Bug fixes and misc changes bumps the **patch**.
76
+
77
+ An example would be `1.0.0`.
78
+
79
+ ## How it works
80
+
81
+ At any given time, the `.semversioner/` directory looks like:
82
+
83
+ ```text
84
+ .semversioner
85
+ ├── next-release
86
+ │ ├── minor-20181227010225.json
87
+ │ └── major-20181228010225.json
88
+ ├── 1.1.0.json
89
+ ├── 1.1.1.json
90
+ └── 1.1.2.json
91
+ ```
92
+
93
+ The release process takes everything in the `next-release` directory and aggregates them all together in a single JSON file for that release (e.g., `1.12.0.json`). This JSON file is a list of all the individual JSON files from `next-release`.
94
+
95
+ ## Install
96
+
97
+ ```shell
98
+ pip install semversioner
99
+ ```
100
+
101
+ ## Usage
102
+
103
+ You can use the `--help` option on any command to see the available options:
104
+
105
+ ```shell
106
+ semversioner --help
107
+ ```
108
+
109
+ ### Adding changesets
110
+
111
+ In your local environment, you can use the CLI to create the different changeset files that will be committed with your code. This ensures that every pull request or commit contains its own self-contained change description and version bump intention.
112
+
113
+ ```shell
114
+ semversioner add-change --type patch --description "Fix security vulnerability with authentication."
115
+ ```
116
+
117
+ Allowed `--type` values are: `major`, `minor`, `patch`.
118
+
119
+ You can also add custom attributes to the changeset file that will be available later in your release template. Use the `--attributes` flag in `key=value` format (you can pass it multiple times):
120
+
121
+ ```shell
122
+ semversioner add-change --type patch \
123
+ --description "My custom changelog message with attributes." \
124
+ --attributes pr_id=322 \
125
+ --attributes issue_id=123
126
+ ```
127
+
128
+ ### Checking working directory status
129
+
130
+ You can check the status of your working directory to see the current version, the computed next version, and any unreleased changes:
131
+
132
+ ```shell
133
+ semversioner status
134
+ ```
135
+
136
+ Example output:
137
+
138
+ ```text
139
+ Version: 1.0.0
140
+ Next version: 1.1.0
141
+ Unreleased changes:
142
+ minor: Added new authentication feature
143
+ (use "semversioner release" to release the next version)
144
+ ```
145
+
146
+ ### Enforcing changesets in CI/CD (Check)
147
+
148
+ In your CI/CD pipeline, it's often useful to enforce that a PR includes a changeset before merging. You can use the `check` command to verify that there are unreleased changes in the `.semversioner/next-release/` directory.
149
+
150
+ ```shell
151
+ semversioner check
152
+ ```
153
+
154
+ If no changes are found, the command exits with a non-zero status code (`-1`) and prints an error message.
155
+
156
+ ### Releasing a new version
157
+
158
+ When you are ready to create a release (usually in your CI/CD tool on the main branch), you run the `release` command. This automatically computes the new version number based on the unreleased changes, generates a new version JSON file, and clears the `next-release` directory.
159
+
160
+ ```shell
161
+ semversioner release
162
+ ```
163
+
164
+ ### Generating the Changelog
165
+
166
+ As part of your release workflow, you can generate the changelog file with all aggregated changes.
167
+
168
+ ```shell
169
+ semversioner changelog > CHANGELOG.md
170
+ ```
171
+
172
+ #### Customizing the changelog template
173
+
174
+ You can customize the changelog by creating a template and passing it as a parameter to the command. For example:
175
+
176
+ ```shell
177
+ semversioner changelog --template .semversioner/config/template.j2
178
+ ```
179
+
180
+ The template uses [Jinja2](https://jinja.palletsprojects.com/en/3.1.x/), a templating language for Python. A basic example:
181
+
182
+ ```jinja2
183
+ # Changelog
184
+ {% for release in releases %}
185
+
186
+ ## {{ release.version }}
187
+
188
+ {% for change in release.changes %}
189
+ - {{ change.type }}: {{ change.description }}
190
+ {% endfor %}
191
+ {% endfor %}
192
+ ```
193
+
194
+ If you included custom attributes (e.g., `pr_id`, `issue_id`) using the `add-change` command, you can reference them in your template. You also have access to `current_version`:
195
+
196
+ ```jinja2
197
+ # Changelog
198
+ Note: version releases in the 0.x.y range may introduce breaking changes.
199
+
200
+ # Current version: {{ current_version }}
201
+
202
+ {% for release in releases %}
203
+
204
+ ## {{ release.version }}{{ ' (' + release.created_at.strftime('%Y-%m-%d') + ')' if release.created_at }}
205
+
206
+ {% for change in release.changes %}
207
+ - {{ change.type }}: {{ change.description }}{{ ' (#' + change.attributes.pr_id + ')' if change.attributes }}{{ ' (J' + change.attributes.issue_id + ')' if change.attributes }}
208
+ {% endfor %}
209
+ {% endfor %}
210
+ ```
211
+
212
+ #### Filtering the changelog
213
+
214
+ You can filter the changelog by only showing changes for a specific version:
215
+
216
+ ```shell
217
+ semversioner changelog --version "1.0.0"
218
+ ```
219
+
220
+ Alternatively, you can filter changes for the last released version:
221
+
222
+ ```shell
223
+ semversioner changelog --version $(semversioner current-version)
224
+ ```
225
+
226
+ ### Getting the current version
227
+
228
+ You can retrieve the currently released version of your project:
229
+
230
+ ```shell
231
+ semversioner current-version
232
+ ```
233
+
234
+ ### Getting the next version
235
+
236
+ As part of the CI/CD workflow, sometimes you want to release dev, rc, or other pre-release packages. For this purpose, the `next-version` command can be issued to compute the upcoming version based on the current changeset. This will not modify any files on disk.
237
+
238
+ ```shell
239
+ semversioner next-version
240
+ ```
241
+
242
+ ## Global Options
243
+
244
+ - `--path`: Specify a custom base path for your project. Defaults to the current directory. Example: `semversioner --path /path/to/project release`
245
+
246
+ ## License
247
+
248
+ Copyright (c) 2026 Raul Gomis.
249
+ MIT licensed, see [LICENSE](LICENSE) file.
250
+
251
+ ---
252
+ Made with ♥ by [Raul Gomis](https://twitter.com/rgomis).
@@ -0,0 +1,198 @@
1
+ # Semversioner
2
+
3
+ The easiest way to manage [semantic versioning](https://semver.org/) in your project and generate `CHANGELOG.md` files automatically.
4
+
5
+ Semversioner provides the tooling to automate the semver release process for libraries, docker images, microservices, and more.
6
+
7
+ This project was inspired by the way AWS manages their versioning for [AWS-cli](https://github.com/aws/aws-cli/).
8
+
9
+ [![PyPI Version](https://img.shields.io/pypi/v/semversioner.svg)](https://pypi.org/project/semversioner/)
10
+
11
+ ## Semantic Versioning
12
+
13
+ The [semantic versioning](https://semver.org/) spec involves several possible variations, but to simplify, in _Semversioner_ we are using the three-part version number:
14
+
15
+ `<major>.<minor>.<patch>`
16
+
17
+ Constructed with the following guidelines:
18
+
19
+ - Breaking backward compatibility or major features bumps the **major** (and resets the minor and patch).
20
+ - New additions without breaking backward compatibility bumps the **minor** (and resets the patch).
21
+ - Bug fixes and misc changes bumps the **patch**.
22
+
23
+ An example would be `1.0.0`.
24
+
25
+ ## How it works
26
+
27
+ At any given time, the `.semversioner/` directory looks like:
28
+
29
+ ```text
30
+ .semversioner
31
+ ├── next-release
32
+ │ ├── minor-20181227010225.json
33
+ │ └── major-20181228010225.json
34
+ ├── 1.1.0.json
35
+ ├── 1.1.1.json
36
+ └── 1.1.2.json
37
+ ```
38
+
39
+ The release process takes everything in the `next-release` directory and aggregates them all together in a single JSON file for that release (e.g., `1.12.0.json`). This JSON file is a list of all the individual JSON files from `next-release`.
40
+
41
+ ## Install
42
+
43
+ ```shell
44
+ pip install semversioner
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ You can use the `--help` option on any command to see the available options:
50
+
51
+ ```shell
52
+ semversioner --help
53
+ ```
54
+
55
+ ### Adding changesets
56
+
57
+ In your local environment, you can use the CLI to create the different changeset files that will be committed with your code. This ensures that every pull request or commit contains its own self-contained change description and version bump intention.
58
+
59
+ ```shell
60
+ semversioner add-change --type patch --description "Fix security vulnerability with authentication."
61
+ ```
62
+
63
+ Allowed `--type` values are: `major`, `minor`, `patch`.
64
+
65
+ You can also add custom attributes to the changeset file that will be available later in your release template. Use the `--attributes` flag in `key=value` format (you can pass it multiple times):
66
+
67
+ ```shell
68
+ semversioner add-change --type patch \
69
+ --description "My custom changelog message with attributes." \
70
+ --attributes pr_id=322 \
71
+ --attributes issue_id=123
72
+ ```
73
+
74
+ ### Checking working directory status
75
+
76
+ You can check the status of your working directory to see the current version, the computed next version, and any unreleased changes:
77
+
78
+ ```shell
79
+ semversioner status
80
+ ```
81
+
82
+ Example output:
83
+
84
+ ```text
85
+ Version: 1.0.0
86
+ Next version: 1.1.0
87
+ Unreleased changes:
88
+ minor: Added new authentication feature
89
+ (use "semversioner release" to release the next version)
90
+ ```
91
+
92
+ ### Enforcing changesets in CI/CD (Check)
93
+
94
+ In your CI/CD pipeline, it's often useful to enforce that a PR includes a changeset before merging. You can use the `check` command to verify that there are unreleased changes in the `.semversioner/next-release/` directory.
95
+
96
+ ```shell
97
+ semversioner check
98
+ ```
99
+
100
+ If no changes are found, the command exits with a non-zero status code (`-1`) and prints an error message.
101
+
102
+ ### Releasing a new version
103
+
104
+ When you are ready to create a release (usually in your CI/CD tool on the main branch), you run the `release` command. This automatically computes the new version number based on the unreleased changes, generates a new version JSON file, and clears the `next-release` directory.
105
+
106
+ ```shell
107
+ semversioner release
108
+ ```
109
+
110
+ ### Generating the Changelog
111
+
112
+ As part of your release workflow, you can generate the changelog file with all aggregated changes.
113
+
114
+ ```shell
115
+ semversioner changelog > CHANGELOG.md
116
+ ```
117
+
118
+ #### Customizing the changelog template
119
+
120
+ You can customize the changelog by creating a template and passing it as a parameter to the command. For example:
121
+
122
+ ```shell
123
+ semversioner changelog --template .semversioner/config/template.j2
124
+ ```
125
+
126
+ The template uses [Jinja2](https://jinja.palletsprojects.com/en/3.1.x/), a templating language for Python. A basic example:
127
+
128
+ ```jinja2
129
+ # Changelog
130
+ {% for release in releases %}
131
+
132
+ ## {{ release.version }}
133
+
134
+ {% for change in release.changes %}
135
+ - {{ change.type }}: {{ change.description }}
136
+ {% endfor %}
137
+ {% endfor %}
138
+ ```
139
+
140
+ If you included custom attributes (e.g., `pr_id`, `issue_id`) using the `add-change` command, you can reference them in your template. You also have access to `current_version`:
141
+
142
+ ```jinja2
143
+ # Changelog
144
+ Note: version releases in the 0.x.y range may introduce breaking changes.
145
+
146
+ # Current version: {{ current_version }}
147
+
148
+ {% for release in releases %}
149
+
150
+ ## {{ release.version }}{{ ' (' + release.created_at.strftime('%Y-%m-%d') + ')' if release.created_at }}
151
+
152
+ {% for change in release.changes %}
153
+ - {{ change.type }}: {{ change.description }}{{ ' (#' + change.attributes.pr_id + ')' if change.attributes }}{{ ' (J' + change.attributes.issue_id + ')' if change.attributes }}
154
+ {% endfor %}
155
+ {% endfor %}
156
+ ```
157
+
158
+ #### Filtering the changelog
159
+
160
+ You can filter the changelog by only showing changes for a specific version:
161
+
162
+ ```shell
163
+ semversioner changelog --version "1.0.0"
164
+ ```
165
+
166
+ Alternatively, you can filter changes for the last released version:
167
+
168
+ ```shell
169
+ semversioner changelog --version $(semversioner current-version)
170
+ ```
171
+
172
+ ### Getting the current version
173
+
174
+ You can retrieve the currently released version of your project:
175
+
176
+ ```shell
177
+ semversioner current-version
178
+ ```
179
+
180
+ ### Getting the next version
181
+
182
+ As part of the CI/CD workflow, sometimes you want to release dev, rc, or other pre-release packages. For this purpose, the `next-version` command can be issued to compute the upcoming version based on the current changeset. This will not modify any files on disk.
183
+
184
+ ```shell
185
+ semversioner next-version
186
+ ```
187
+
188
+ ## Global Options
189
+
190
+ - `--path`: Specify a custom base path for your project. Defaults to the current directory. Example: `semversioner --path /path/to/project release`
191
+
192
+ ## License
193
+
194
+ Copyright (c) 2026 Raul Gomis.
195
+ MIT licensed, see [LICENSE](LICENSE) file.
196
+
197
+ ---
198
+ Made with ♥ by [Raul Gomis](https://twitter.com/rgomis).
@@ -0,0 +1,69 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "semversioner"
7
+ dynamic = ["version"]
8
+ description = "Manage properly semver in your repository"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Raul Gomis", email = "raulgomis@gmail.com"}
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: End Users/Desktop",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Programming Language :: Python :: 3.14",
28
+ "Operating System :: OS Independent",
29
+ ]
30
+ dependencies = [
31
+ "click>=8.0.0",
32
+ "jinja2>=3.0.0",
33
+ "packaging>=21.0",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest>=9.0.0",
39
+ "pytest-cov>=6.0.0",
40
+ "importlib_resources>=6.0.0",
41
+ "ruff>=0.9.0",
42
+ ]
43
+
44
+ [project.scripts]
45
+ semversioner = "semversioner.__main__:main"
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/raulgomis/semversioner"
49
+
50
+ [tool.setuptools]
51
+ packages = ["semversioner"]
52
+
53
+ [tool.setuptools.dynamic]
54
+ version = {attr = "semversioner.__version__.__version__"}
55
+
56
+ [tool.ruff]
57
+ line-length = 120
58
+ target-version = "py310"
59
+
60
+ [tool.ruff.lint]
61
+ select = ["E", "F", "W", "I", "C90", "N", "UP", "B", "A", "C4", "PT", "ARG", "RET", "SIM", "PTH", "ERA"]
62
+ ignore = ["E501"]
63
+
64
+ [tool.ruff.lint.per-file-ignores]
65
+ "semversioner/__init__.py" = ["F401"]
66
+ "tests/*" = ["ARG001", "ARG002", "PTH", "PT"]
67
+
68
+ [tool.ruff.lint.isort]
69
+ known-first-party = ["semversioner"]
@@ -0,0 +1,14 @@
1
+ from semversioner.__version__ import __version__
2
+ from semversioner.core import Semversioner
3
+ from semversioner.models import (
4
+ Changeset,
5
+ MissingChangesetError,
6
+ Release,
7
+ ReleaseStatus,
8
+ ReleaseType,
9
+ SemversionerError,
10
+ )
11
+ from semversioner.storage import (
12
+ SemversionerFileSystemStorage,
13
+ SemversionerStorage,
14
+ )
@@ -0,0 +1 @@
1
+ __version__ = "3.0.0"