🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

hatch-semver

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hatch-semver

Hatch plugin for semver versioning scheme

2.0.2
PyPI
Maintainers
1

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 VersionCommandNew Version
0.1.0patch0.1.1
0.1.1minor,patch,patch0.2.2
0.2.2minor0.3.0
0.3.0rc0.3.1-rc.1
0.3.1-rc.1rc0.3.1-rc.2
0.3.1-rc.2release0.3.1
0.3.10.9.50.9.5
0.9.5major,rc1.0.0-rc.1
1.0.0-rc.1release1.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.

Keywords

development

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts