From bb24f7fb185474821ffe397acac1b900a225cbd7 Mon Sep 17 00:00:00 2001 From: David C Ellis Date: Wed, 17 Jul 2024 13:26:39 +0100 Subject: [PATCH] Simplify version template for setuptools-scm --- pyproject.toml | 2 ++ src/ducktools/classbuilder/__init__.py | 2 +- src/ducktools/classbuilder/__init__.pyi | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e579afe..f77c143 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,8 @@ where = ["src"] [tool.setuptools_scm] version_file = "src/ducktools/classbuilder/_version.py" +version_file_template = "__version__ = \"{version}\"\n__version_tuple__ = {version_tuple}\n" + [project.optional-dependencies] testing = ["pytest>=8.2", "pytest-cov", "mypy", "typing_extensions"] diff --git a/src/ducktools/classbuilder/__init__.py b/src/ducktools/classbuilder/__init__.py index d9cae82..933a8fa 100644 --- a/src/ducktools/classbuilder/__init__.py +++ b/src/ducktools/classbuilder/__init__.py @@ -33,7 +33,7 @@ import os from .annotations import get_ns_annotations, is_classvar -from ._version import __version__ +from ._version import __version__, __version_tuple__ # Change this name if you make heavy modifications INTERNALS_DICT = "__classbuilder_internals__" diff --git a/src/ducktools/classbuilder/__init__.pyi b/src/ducktools/classbuilder/__init__.pyi index eb25f10..70d2919 100644 --- a/src/ducktools/classbuilder/__init__.pyi +++ b/src/ducktools/classbuilder/__init__.pyi @@ -11,6 +11,7 @@ _py_type = type | str # Alias for type hint values _CopiableMappings = dict[str, typing.Any] | MappingProxyType[str, typing.Any] __version__: str +__version_tuple__: tuple[str | int, ...] INTERNALS_DICT: str META_GATHERER_NAME: str