diff --git a/.gitignore b/.gitignore index 2dc53ca3..4a1862f2 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ + +# hatch-vcs +src/tinytext/_version.py diff --git a/pyproject.toml b/pyproject.toml index 9df898f8..298ec6ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,9 @@ scripts.tinytext = "tinytext.cli:main" [tool.hatch] version.source = "vcs" +[tool.hatch.build.hooks.vcs] +version-file = "src/tinytext/_version.py" + [tool.hatch.version.raw-options] local_scheme = "no-local-version" diff --git a/src/tinytext/__init__.py b/src/tinytext/__init__.py index f3fa199e..271ac98d 100644 --- a/src/tinytext/__init__.py +++ b/src/tinytext/__init__.py @@ -1,8 +1,8 @@ from __future__ import annotations -import importlib.metadata +from tinytext import _version # type: ignore[attr-defined] -__version__ = importlib.metadata.version(__name__) +__version__ = _version.__version__ __all__ = ["__version__"]