blackopsrepl commited on
Commit
197eaf5
·
1 Parent(s): 5b40a89

feat: display version on main page

Browse files
Files changed (2) hide show
  1. src/app.py +11 -0
  2. src/utils/version.py +36 -0
src/app.py CHANGED
@@ -2,6 +2,7 @@ import os, argparse
2
  import gradio as gr
3
 
4
  from utils.logging_config import setup_logging, get_logger
 
5
 
6
  # Initialize logging early - will be reconfigured based on debug mode
7
  setup_logging()
@@ -46,6 +47,16 @@ def app(debug: bool = False):
46
 
47
  draw_chat_page(debug)
48
 
 
 
 
 
 
 
 
 
 
 
49
  # Register the MCP tool as an API endpoint
50
  gr.api(process_message_and_attached_file)
51
 
 
2
  import gradio as gr
3
 
4
  from utils.logging_config import setup_logging, get_logger
5
+ from utils.version import __version__
6
 
7
  # Initialize logging early - will be reconfigured based on debug mode
8
  setup_logging()
 
47
 
48
  draw_chat_page(debug)
49
 
50
+ # Version footer
51
+ gr.Markdown(
52
+ f"""
53
+ <div style="text-align: center; margin-top: 2rem; padding: 1rem; color: #666; font-size: 0.8rem;">
54
+ Yuga Planner v{__version__}
55
+ </div>
56
+ """,
57
+ elem_classes=["version-footer"],
58
+ )
59
+
60
  # Register the MCP tool as an API endpoint
61
  gr.api(process_message_and_attached_file)
62
 
src/utils/version.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Version utilities for the Yuga Planner application."""
2
+
3
+ import os
4
+ import re
5
+
6
+
7
+ def get_version_from_changelog():
8
+ """Extract the latest version from CHANGELOG.md
9
+
10
+ Returns:
11
+ str: The latest version string (e.g., "0.6.4") or "unknown" if not found
12
+ """
13
+ try:
14
+ # Get the project root directory (assuming this file is in src/utils/)
15
+ project_root = os.path.dirname(
16
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
+ )
18
+ changelog_path = os.path.join(project_root, "CHANGELOG.md")
19
+
20
+ with open(changelog_path, "r", encoding="utf-8") as f:
21
+ content = f.read()
22
+
23
+ # Look for version pattern like ## [0.6.4]
24
+ version_pattern = r"## \[(\d+\.\d+\.\d+)\]"
25
+ match = re.search(version_pattern, content)
26
+
27
+ if match:
28
+ return match.group(1)
29
+ else:
30
+ return "unknown"
31
+ except (FileNotFoundError, Exception):
32
+ return "unknown"
33
+
34
+
35
+ # Application version - dynamically fetched from changelog
36
+ __version__ = get_version_from_changelog()