Skip to main content

Hatch build hooks plugin for version bumping

Project description

hatch-bump-version

PyPI - Version PyPI - Python Version

This package provides the bump version build hook for hatch. It builds on the git plumbing script to increment the version number in a project's git tag (download from https://github.com/krokoreit/git-bump-version).

It purpose is to check the project version number and to automatically increment it in case the current version has already been published. This avoids the annoying 'already published' message when trying to publish a project to PyPI.

Use the pre-index-publisher to track the version published and provide the information for this build hook.

Add "hatch-bump-version" to the build-system requirements in your project's pyproject.toml

  [build-system]
  requires = [
    "hatchling",
    "hatch-bump-version",
    "hatch-vcs"
  ]

Also include a settings section for [tool.hatch.build.hooks.bump_version] (with 'bump_version' being the name of the plugin). No entries for the plugin are required, but the section must be included for the plugin to be activated.

  [tool.hatch.build.hooks.bump_version]
  #nothing for this plugin 

The pluging will then run as a hook before the build process.


Enjoy

 krokoreit
   

Installation

The plugin will be installed by hatch when creating the build environment. There no need to install it manually.

Usage

When your project's pyproject.toml contains "hatch-bump-version" in the build-system requirements and a [tool.hatch.build.hooks.bump_version] section, the plugin is automatically started before the actual build process triggered by

  hatch build

It will then display in the console either

  [BumpVersionBuildHook] No version bump needed.

or

  [BumpVersionBuildHook] Version already published  bumping version...

followed by the information given by the bump version script.


License

MIT license
Copyright © 2025 by krokoreit

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_bump_version-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

hatch_bump_version-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file hatch_bump_version-1.0.0.tar.gz.

File metadata

  • Download URL: hatch_bump_version-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.13.2 HTTPX/0.28.1

File hashes

Hashes for hatch_bump_version-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80c96b9d33ee92cb746ceaa595f2aca4aee36e2c0745c3ea5863518b870a8b32
MD5 45c16ac26d42ac5afa3f10dd4b217847
BLAKE2b-256 aadee1c5f84f7217622963b613a5be498f6d4b605e7bce82296c8ce6f5fe38a3

See more details on using hashes here.

File details

Details for the file hatch_bump_version-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_bump_version-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33976a50b659a765b2590d206c257630a7571773f90da91a63973842f493f475
MD5 5c84b3ee105130e1ebe38cb8cfc38621
BLAKE2b-256 cc7cbacbbee6ef415a8422b0ac371cb5b19eee0a5a6d0a801f30740c1957f68d

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