From d858b14e8b57e35abef6a6c712f481d5d045c819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=20Vinh=20LUONG=20=28LU=CC=9BO=CC=9BNG=20The=CC=82?= =?UTF-8?q?=CC=81=20Vinh=29?= Date: Fri, 15 Dec 2023 08:34:02 -0800 Subject: [PATCH] retrieve version info directly from pyproject.toml; remove duplicative openssa/VERSION file --- openssa/VERSION | 1 - openssa/__init__.py | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 openssa/VERSION diff --git a/openssa/VERSION b/openssa/VERSION deleted file mode 100644 index 70256a2bd..000000000 --- a/openssa/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.23.12.14 diff --git a/openssa/__init__.py b/openssa/__init__.py index b2546a730..90341f4b4 100644 --- a/openssa/__init__.py +++ b/openssa/__init__.py @@ -1,10 +1,6 @@ -import os - -with open(os.path.join(os.path.dirname(__file__), "VERSION"), "r", encoding="utf-8") as f: - __version__ = f.read().strip() - - -from importlib.metadata import version +from collections.abc import Sequence +from pathlib import Path +import tomllib from openssa.core.ooda_rag.heuristic import TaskDecompositionHeuristic from openssa.core.ooda_rag.solver import OodaSSA @@ -26,3 +22,12 @@ from openssa.utils.config import Config from openssa.utils.logs import Logs, logger, mlogger from openssa.utils.utils import Utils + + +with open(file=Path(__file__).parent.parent / 'pyproject.toml', mode='rb') as f: + __version__: str = tomllib.load(f)['tool']['poetry']['version'] + + +__all__: Sequence[str] = ( + '__version__', +)