Hatch plugin for semver versioning scheme
Project description
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>=1.8.0",
"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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hatch_semver-1.0.0.tar.gz
.
File metadata
- Download URL: hatch_semver-1.0.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ecaa3be09ae4c424cedd3059ea3d98871f0a618592772f074c9779259c27d1 |
|
MD5 | 28d6be340fa2b0c23cae9b507b59b42d |
|
BLAKE2b-256 | d0cd861939a03b869740dfb697ea38743c8e015ccee8c9091c4d09e5ee774943 |
File details
Details for the file hatch_semver-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: hatch_semver-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaf92ba0c418466534dce21ced18069e9b639fa5d08c6d5b643a9f75bd30e072 |
|
MD5 | 275b72abca00620e88f4d02685629293 |
|
BLAKE2b-256 | d8b26354d65cbc5aaad11b61424c34dc8896f95717673db688ccc56bc41adbbf |