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.
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
- Python >= 3.9
pip install hatch-timestamp-version
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"
- 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
See CHANGELOG.md
- Inspired by Simon Willison's work.
MIT © Visesh Prasad