hatch-semver
A plugin for hatch to support semantic versioning. Hatch-semver relies on python-semver for all the versioning logic.
Setup
Introduce hatch-semver as a build-dependency to your project (in your pyproject.toml):
[build-system]
requires = [
"hatchling",
"hatch-semver",
]
build-backend = "hatchling.build"
Further down in pyproject.toml,
where you set up the hatch version command,
set version scheme to semver:
[tool.hatch.version]
path = "src/<your_project>/__about__.py"
validate-bump = true
scheme = "semver"
Beware
Hatch-semver plugin will only work with project versions which can be readily parsed by python-semver. 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. You can test that here.
Quick Start
Many of hatch's standard versioning commands also work for hatch-semver to bump your project's version in a semver-compliant way.
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>.
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:
| Old Version | Command | New Version |
|---|---|---|
0.1.0 |
patch |
0.1.1 |
0.1.1 |
minor,patch,patch |
0.2.2 |
0.2.2 |
minor |
0.3.0 |
0.3.0 |
rc |
0.3.1-rc.1 |
0.3.1-rc.1 |
rc |
0.3.1-rc.2 |
0.3.1-rc.2 |
release |
0.3.1 |
0.3.1 |
0.9.5 |
0.9.5 |
0.9.5 |
major,rc |
1.0.0-rc.1 |
1.0.0-rc.1 |
release |
1.0.0 |
See the command reference for all the commands in full detail. If you are familiar with hatch's standard versioning scheme, perhaps a comparison of the standard scheme and hatch-semver will be of interest.
Metadata
Release files for hatch-semver 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hatch_semver-2.0.2.tar.gz | 20.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hatch_semver-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.1 kB
Release files / hatch_semver-2.0.2.tar.gz
| Download URL | hatch_semver-2.0.2.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c59c8c1eb30de1e961610d33a375746c658607fa49414081a6940f6b8466fae
|
|
BLAKE2b-256 checksum How to use checksums |
6de9ebd2948509aad51fe99419293efc31246b6af3d0c488964f653b2c090ff1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.25.1
|
Release files / hatch_semver-2.0.2-py3-none-any.whl
| Download URL | hatch_semver-2.0.2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ad36f9e0b7148267ed55bf4e5855ad947e700ec4316e54b94cae26fbb89aa81
|
|
BLAKE2b-256 checksum How to use checksums |
b3684d1c29a989d3a692cebc4a85f875aac7cd0d6c25adbc760222008509333c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.25.1
|