From 1ad03b2f9e6ce42da259c21d8c0dd00b1745b613 Mon Sep 17 00:00:00 2001 From: Janaka Abeywardhana Date: Sat, 7 Sep 2024 23:23:29 +0100 Subject: [PATCH] fix: incorrect docq version showing in UI --- pyproject.toml | 2 +- source/docq/__init__.py | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 63425a86..acbe4b3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "docq" -version = "0.13.1" +version = "0.13.2" description = "Docq.AI - Your private ChatGPT alternative. Securely unlock knowledge from confidential documents." authors = ["Docq.AI Team "] maintainers = ["Docq.AI Team "] diff --git a/source/docq/__init__.py b/source/docq/__init__.py index ea6564d5..eb458cd0 100644 --- a/source/docq/__init__.py +++ b/source/docq/__init__.py @@ -1,24 +1,25 @@ """Docq module.""" import importlib.metadata as __metadata__ -_pkg_metadata = __metadata__.metadata(__package__).json -project_urls = {} -for item in _pkg_metadata["project_url"]: - key, value = item.split(", ") - project_urls[key] = value - - -# data from pyproject.toml -__version__ = _pkg_metadata["version"] # version field -__version_str__ = str(__version__) -__summary__ = _pkg_metadata["summary"] # description field -__description__ = _pkg_metadata["description"] # readme field -__homepage_url__ = _pkg_metadata["home_page"] # homepage field -__documentation_url__ = project_urls["Documentation"] # documentation field -__repository_url__ = project_urls["Repository"] # repository field -__author_email__ = _pkg_metadata["author_email"] # authors field -__maintainer_email__ = _pkg_metadata["maintainer_email"] # maintainers field +if __package__ is not None: + _pkg_metadata = __metadata__.metadata(__package__).json + project_urls = {} + for item in _pkg_metadata["project_url"]: + key, value = item.split(", ") + project_urls[key] = value + # data from pyproject.toml + __version__ = _pkg_metadata["version"] # version field + __version_str__ = str(__version__) + __summary__ = _pkg_metadata["summary"] # description field + __description__ = _pkg_metadata["description"] # readme field + __homepage_url__ = _pkg_metadata["home_page"] # homepage field + __documentation_url__ = project_urls["Documentation"] # documentation field + __repository_url__ = project_urls["Repository"] # repository field + __author_email__ = _pkg_metadata["author_email"] # authors field + __maintainer_email__ = _pkg_metadata["maintainer_email"] # maintainers field +else: + raise ValueError("Package name is not defined") __all__ = [ "config",