Skip to main content

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",
    "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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_semver-2.0.2.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

hatch_semver-2.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file hatch_semver-2.0.2.tar.gz.

File metadata

  • Download URL: hatch_semver-2.0.2.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.25.1

File hashes

Hashes for hatch_semver-2.0.2.tar.gz
Algorithm Hash digest
SHA256 3c59c8c1eb30de1e961610d33a375746c658607fa49414081a6940f6b8466fae
MD5 fd8444416a4ad9c41ce18872504e2be3
BLAKE2b-256 6de9ebd2948509aad51fe99419293efc31246b6af3d0c488964f653b2c090ff1

See more details on using hashes here.

File details

Details for the file hatch_semver-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_semver-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ad36f9e0b7148267ed55bf4e5855ad947e700ec4316e54b94cae26fbb89aa81
MD5 c9d8ebe21244cccd97d9e89a9d3ed9ba
BLAKE2b-256 b3684d1c29a989d3a692cebc4a85f875aac7cd0d6c25adbc760222008509333c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page