From 04f132cebe13d6619774da95a78c87eac524ea09 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Tue, 9 Jan 2024 00:28:59 +0100 Subject: [PATCH] reduce version duplication --- src/cydifflib/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cydifflib/__init__.py b/src/cydifflib/__init__.py index 6e2d9cd..2dd4db7 100644 --- a/src/cydifflib/__init__.py +++ b/src/cydifflib/__init__.py @@ -29,6 +29,12 @@ __author__ = "Max Bachmann" __license__ = "MIT" -__version__ = "1.0.1" + +import importlib.metadata + +try: + __version__: str = importlib.metadata.version(__package__ or __name__) +except importlib.metadata.PackageNotFoundError: + __version__: str = "0.0.0" from ._initialize import *