diff --git a/.gitignore b/.gitignore index 8b6ca4e..18a1ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -399,3 +399,6 @@ $RECYCLE.BIN/ *.lnk # End of https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs + +# hatch-vcs +cherry_picker/_version.py diff --git a/cherry_picker/__init__.py b/cherry_picker/__init__.py index 843751f..5a6ec37 100644 --- a/cherry_picker/__init__.py +++ b/cherry_picker/__init__.py @@ -2,6 +2,6 @@ from __future__ import annotations -import importlib.metadata +from ._version import __version__ -__version__ = importlib.metadata.version(__name__) +__all__ = ["__version__"] diff --git a/pyproject.toml b/pyproject.toml index 35a72fc..a0021ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,9 @@ source = "vcs" # Change regex to match tags like "cherry-picker-v2.2.0". tag-pattern = '^cherry-picker-(?P[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$' +[tool.hatch.build.hooks.vcs] +version-file = "cherry_picker/_version.py" + [tool.hatch.version.raw-options] local_scheme = "no-local-version"