From 4897cd0387ed24b099cb806b3e51a95e5104f6ac Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 11 May 2023 20:52:15 +0200 Subject: [PATCH] Fixed missing version resolution without pyproject.toml --- rnsh/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rnsh/__init__.py b/rnsh/__init__.py index 99afd9f..7c1e6b2 100644 --- a/rnsh/__init__.py +++ b/rnsh/__init__.py @@ -31,7 +31,11 @@ def _get_version(): import tomli return tomli.load(open(os.path.join(os.path.dirname(module_dir), "pyproject.toml"), "rb"))["tool"]["poetry"]["version"] except: - return "0.0.0" + try: + import pkg_resources + return pkg_resources.get_distribution("rnsh").version + except: + return "0.0.0" except: return "0.0.0"