Skip to content

A hatch plugin that provides a custom version scheme using git tags for release versions and UTC timestamps for development versions. Based on top of hatch-vcs.

License

Notifications You must be signed in to change notification settings

viseshrp/hatch-timestamp-version

Repository files navigation

hatch-timestamp-version

PyPI version Python versions CI Coverage License: MIT Code Style: Black Lint: Ruff Typing: mypy

A hatch plugin that provides a custom version scheme using git tags for release versions and a combination of git tags and UTC timestamps for development versions. Based on top of hatch-vcs.

🚀 Why this project exists

I have CI continuously deploy to 'Test PyPI' and I want packages to have the datetime as dev versions.

Eg: reelname-2.0.4.dev20250526231209-py3-none-any.whl

📐 Requirements

  • Python >= 3.9

📦 Installation

pip install hatch-timestamp-version

🧪 Usage

In your pyproject.toml:

[build-system]
requires = ["hatchling", "hatch-timestamp-version>=0.0.5"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "yourpkg/_version.py"
source = "vcs-dev-timestamp"  # enables this plugin
validate-bump = true

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
# the only available config option for this plugin
timestamp_format = "short"  # or "long" for full datetime or any strftime string like "%Y%m%d%H%M"

🛠️ Features

  • Uses datetime for the dev versions, when used with hatch-vcs
  • Supports three options for timestamp format:
    • short - YYYYMMDD
    • long - YYYYMMDDHHMMSS (default)
    • Custom strftime formats like %Y%m%d%H%M
$ hatch version
2.0.4.dev20250526231209

🧾 Changelog

See CHANGELOG.md

🙏 Credits

📄 License

MIT © Visesh Prasad

About

A hatch plugin that provides a custom version scheme using git tags for release versions and UTC timestamps for development versions. Based on top of hatch-vcs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published