diff --git a/.gitignore b/.gitignore index 009c104..353ced5 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,6 @@ ENV/ # pytest .pytest_cache/ + +# hatch-vcs +src/*/_version.py diff --git a/pyproject.toml b/pyproject.toml index cad458f..713dfb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,9 @@ scripts.blurb = "blurb.blurb:main" [tool.hatch] version.source = "vcs" +[tool.hatch.build.hooks.vcs] +version-file = "src/blurb/_version.py" + [tool.hatch.version.raw-options] local_scheme = "no-local-version" diff --git a/src/blurb/__init__.py b/src/blurb/__init__.py index 63dfcac..8dee4bf 100644 --- a/src/blurb/__init__.py +++ b/src/blurb/__init__.py @@ -1,3 +1 @@ -import importlib.metadata - -__version__ = importlib.metadata.version(__name__) +from ._version import __version__