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>=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


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-1.0.1.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hatch_semver-1.0.1.tar.gz
Algorithm Hash digest
SHA256 245b6168e1de53dfa43c55a0f8a96d1c204924a515b704df790fb6855bad43b8
MD5 c3722b95b20fa4540a28854bab1175c0
BLAKE2b-256 24eb77adcf4ccbbc3364b4249714b3d46d24b7f09825b87383812a92f940b64e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hatch_semver-1.0.1-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

Hashes for hatch_semver-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8714ac294ac4906ae5433e8219a21d6d12440e2a0e8a0778c4f16e1c9af5237a
MD5 a06188dd7f9e55d9b54f11f3cc33ccdc
BLAKE2b-256 9392360fea2a393859359383d69fea4b272cefcfad544cb64db5e3fb71ffc6cf

See more details on using hashes here.

Supported by

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