You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A plugin for [hatch][hatch] to support [semantic versioning][semver].
3
+
A plugin for [hatch][hatch] to support [semantic versioning][semver]. Hatch-semver relies on [python-semver][python-semver] for all the versioning logic.
4
4
5
+
## Setup
5
6
6
-
## Usage
7
-
8
-
Introduce *hatch-semver* as a build-dependency to your project (in `pyproject.toml`):
7
+
Introduce hatch-semver as a build-dependency to your project (in your `pyproject.toml`):
9
8
10
9
```toml
11
10
[build-system]
@@ -16,17 +15,48 @@ requires = [
16
15
build-backend = "hatchling.build"
17
16
```
18
17
19
-
Further down in `pyproject.toml`, where you specify your project's version, set version scheme
20
-
to `semver`:
18
+
Further down in `pyproject.toml`,
19
+
where you set up the *hatch version* command,
20
+
set version scheme to `semver`:
21
21
```toml
22
22
[tool.hatch.version]
23
23
path = "src/<your_project>/__about__.py"
24
+
validate-bump = True
24
25
scheme = "semver"
25
26
```
26
27
27
-
You can then use hatch's usual [versioning commands][hatch_versioning] to bump your project's
28
-
version in a semver-compliant way.
28
+
### Beware
29
29
30
-
[hatch]: hatch.pypa.io/
31
-
[semver]: https://semver.org/
30
+
Hatch-semver plugin will only work with project versions which can be readily parsed by [python-semver][python-semver].
31
+
Therefore, if you are introducing hatch-semver into an existing project, you must **make sure that the project's current version is a valid semantic version.**
32
+
You can test that [here][semver-regex].
33
+
34
+
## Quick Start
35
+
36
+
Many of hatch's [standard versioning][hatch_versioning] commands also work for hatch-semver to bump your project's version in a semver-compliant way.
37
+
Such command is written as a single string of comma-separated bump instructions as a positional argument of the `hatch version` subcommand, i.e `hatch version <COMMAND>`.
38
+
39
+
Starting with `0.1.0` as the original version, here is a series of example commands which illustrate some common ways how to bump the version:
See the [command reference][commands] for all the commands in full detail. If you are familiar with hatch's standard versioning scheme, perhaps a [comparison][comparison] of the standard scheme and hatch-semver will be of interest.
<stylemedia="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em4em;border-left:1px solid #ddd}precode{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toculul,#indexul{padding-left:1.5em}.toc>ul>li{margin-top:.5em}}</style>
0 commit comments