Skip to content

Commit

Permalink
feat:add version info to about menu topright (#133)
Browse files Browse the repository at this point in the history
* chore: update docq package metadata in pyproject.toml

* refactor(docq): expose package metadata as fields

* feat: display docq ver and other info in ST about menu

* chore: bump version 0.4.1 -> 0.4.2
  • Loading branch information
janaka authored Oct 26, 2023
1 parent 0af19c0 commit 0741e89
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[tool.poetry]
name = "docq"
version = "0.4.1"
description = "Docq"
version = "0.4.2"
description = "Docq.AI - private and secure knowledge insight on your data."
authors = ["Docq.AI Team <[email protected]>"]
maintainers = ["Docq.AI Team <[email protected]>"]
license = "AGPL-3.0-or-later"
homepage = "https://docq.ai"
repository = "https://github.com/docqai/docq"
documentation = "https://github.com/docqai/docq/tree/main/docs/api/"
documentation = "https://docqai.github.io/docq"
readme = "README.md"
packages = [{ include = "docq", from = "source" }]

Expand Down
19 changes: 19 additions & 0 deletions source/docq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
"""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
__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


__all__ = [
"config",
Expand Down
13 changes: 11 additions & 2 deletions web/index.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
"""Page: Home (no auth required)."""

import docq
import streamlit as st
from st_pages import Page, Section, add_page_title, show_pages
from utils.layout import auth_required, init_with_pretty_error_ui, org_selection_ui, production_layout, public_access

from utils.layout import (
auth_required,
configure_top_right_menu,
init_with_pretty_error_ui,
org_selection_ui,
production_layout,
public_access,
)
import importlib.metadata as _metadata
init_with_pretty_error_ui()

configure_top_right_menu()

production_layout()

Expand Down
13 changes: 12 additions & 1 deletion web/utils/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
from typing import List, Tuple

import docq
import streamlit as st
from docq import setup
from docq.access_control.main import SpaceAccessType
Expand Down Expand Up @@ -249,7 +250,17 @@ def __always_hidden_pages() -> None:
hide_pages(["widget", "signup", "verify"])


def __resend_verification_ui(username: st, form: str, ) -> None:
def configure_top_right_menu() -> None:
"""Configure the Streamlit top right menu."""
st.set_page_config(menu_items={"About": f"**{docq.__summary__}** \
Version: **{docq.__version__}** | \
Homepage: {docq.__homepage_url__} | \
Docs: {docq.__documentation_url__} \
Twitter: https://twitter.com/docqai \
"})


def __resend_verification_ui(username: str, form: str, ) -> None:
"""Resend email verification UI."""
msg = st.empty()
msg.error("Your account is not activated. Please check your email for the activation link.")
Expand Down

0 comments on commit 0741e89

Please sign in to comment.