From cdf4f75c5600b52ad0ff098afe7229f632a069ee Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Sun, 13 Aug 2023 11:26:53 +0200 Subject: [PATCH] Add proper __version__ --- fastapi_restful/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fastapi_restful/__init__.py b/fastapi_restful/__init__.py index 3f97a2b2..8ae7eec0 100644 --- a/fastapi_restful/__init__.py +++ b/fastapi_restful/__init__.py @@ -1,6 +1,15 @@ +import importlib.metadata +import warnings + from .cbv_base import Api, Resource, set_responses, take_init_parameters -__version__ = "0.4.3" +try: + __version__ = importlib.metadata.version(__name__) +except importlib.metadata.PackageNotFoundError as e: + warnings.warn(f"Could not determine version of {__name__}", stacklevel=1) + warnings.warn(str(e), stacklevel=1) + __version__ = "unknown" + __all__ = [ "Api",