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.1.tar.gz (9.5 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_bump_version-1.0.1.tar.gz
  • Upload date:
  • Size: 9.5 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.1.tar.gz
Algorithm Hash digest
SHA256 abd15b78b59e159c7cb871c5ec5dfe7772c36862150a48600937e16f523fa28d
MD5 c20fdf7c2cfea13d776b899b616b0525
BLAKE2b-256 08185f7c8dc1abfbc8d11edaae62ddd2ce30ce22f13ce93f9fe81200e7005bce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_bump_version-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 013a17f69791cff4af4e030e0dae5755fa6fa4db78a7202ce51e6ee5405a657c
MD5 80536e769ca0b7652bd348c6a3732d55
BLAKE2b-256 87cbda8b8297ee480e210b300dbd9f147cdad48194bd7b2b12c6e582a245c237

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