|
1 |
| -# hatch-semver |
2 |
| - |
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 |
| - |
5 |
| -## Setup |
6 |
| - |
7 |
| -Introduce hatch-semver as a build-dependency to your project (in your `pyproject.toml`): |
8 |
| - |
9 |
| -```toml |
10 |
| -[build-system] |
11 |
| -requires = [ |
12 |
| - "hatchling", |
13 |
| - "hatch-semver", |
14 |
| -] |
15 |
| -build-backend = "hatchling.build" |
16 |
| -``` |
17 |
| - |
18 |
| -Further down in `pyproject.toml`, |
19 |
| -where you set up the *hatch version* command, |
20 |
| -set version scheme to `semver`: |
21 |
| -```toml |
22 |
| -[tool.hatch.version] |
23 |
| -path = "src/<your_project>/__about__.py" |
24 |
| -validate-bump = true |
25 |
| -scheme = "semver" |
26 |
| -``` |
27 |
| - |
28 |
| -### Beware |
29 |
| - |
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: |
40 |
| - |
41 |
| -| Old Version | Command | New Version | |
42 |
| -| ---------------------- | ------------------- | -------------------- | |
43 |
| -| `0.1.0` | `patch` | `0.1.1` | |
44 |
| -| `0.1.1` | `minor,patch,patch` | `0.2.2` | |
45 |
| -| `0.2.2` | `minor` | `0.3.0` | |
46 |
| -| `0.3.0` | `rc` | `0.3.1-rc.1` | |
47 |
| -| `0.3.1-rc.1` | `rc` | `0.3.1-rc.2` | |
48 |
| -| `0.3.1-rc.2` | `release` | `0.3.1` | |
49 |
| -| `0.3.1` | `0.9.5` | `0.9.5` | |
50 |
| -| `0.9.5` | `major,rc` | `1.0.0-rc.1` | |
51 |
| -| `1.0.0-rc.1` | `release` | `1.0.0` | |
52 |
| - |
53 |
| -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. |
54 |
| - |
55 |
| - |
56 |
| -[hatch]: https://hatch.pypa.io/ |
57 |
| -[hatch_versioning]: https://hatch.pypa.io/latest/version/#updating |
58 |
| -[python-semver]: https://github.com/python-semver/python-semver/tree/maint/v2 |
59 |
| -[semver-regex]: https://regex101.com/r/Ly7O1x/3/ |
60 |
| -[semver]: https://semver.org/ |
61 |
| -[commands]: https://fleetingbytes.github.io/hatch-semver/user_guide/1-commands/ |
62 |
| -[comparison]: https://fleetingbytes.github.io/hatch-semver/user_guide/2-migrating-to-semver/ |
| 1 | +# hatch-semver |
| 2 | + |
| 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 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +Introduce hatch-semver as a build-dependency to your project (in your `pyproject.toml`): |
| 8 | + |
| 9 | +```toml |
| 10 | +[build-system] |
| 11 | +requires = [ |
| 12 | + "hatchling", |
| 13 | + "hatch-semver", |
| 14 | +] |
| 15 | +build-backend = "hatchling.build" |
| 16 | +``` |
| 17 | + |
| 18 | +Further down in `pyproject.toml`, |
| 19 | +where you set up the *hatch version* command, |
| 20 | +set version scheme to `semver`: |
| 21 | +```toml |
| 22 | +[tool.hatch.version] |
| 23 | +path = "src/<your_project>/__about__.py" |
| 24 | +validate-bump = true |
| 25 | +scheme = "semver" |
| 26 | +``` |
| 27 | + |
| 28 | +### Beware |
| 29 | + |
| 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: |
| 40 | + |
| 41 | +| Old Version | Command | New Version | |
| 42 | +| ---------------------- | ------------------- | -------------------- | |
| 43 | +| `0.1.0` | `patch` | `0.1.1` | |
| 44 | +| `0.1.1` | `minor,patch,patch` | `0.2.2` | |
| 45 | +| `0.2.2` | `minor` | `0.3.0` | |
| 46 | +| `0.3.0` | `rc` | `0.3.1-rc.1` | |
| 47 | +| `0.3.1-rc.1` | `rc` | `0.3.1-rc.2` | |
| 48 | +| `0.3.1-rc.2` | `release` | `0.3.1` | |
| 49 | +| `0.3.1` | `0.9.5` | `0.9.5` | |
| 50 | +| `0.9.5` | `major,rc` | `1.0.0-rc.1` | |
| 51 | +| `1.0.0-rc.1` | `release` | `1.0.0` | |
| 52 | + |
| 53 | +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. |
| 54 | + |
| 55 | + |
| 56 | +[hatch]: https://hatch.pypa.io/ |
| 57 | +[hatch_versioning]: https://hatch.pypa.io/latest/version/#updating |
| 58 | +[python-semver]: https://github.com/python-semver/python-semver/tree/maint/v2 |
| 59 | +[semver-regex]: https://regex101.com/r/Ly7O1x/3/ |
| 60 | +[semver]: https://semver.org/ |
| 61 | +[commands]: https://fleetingbytes.github.io/hatch-semver/user_guide/1-commands/ |
| 62 | +[comparison]: https://fleetingbytes.github.io/hatch-semver/user_guide/2-migrating-to-semver/ |
0 commit comments