Repository navigation
Expand file tree
/
Copy pathapp.py
More file actions
106 lines (86 loc) · 3.2 KB
/
Copy pathapp.py
File metadata and controls
106 lines (86 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"""
DeveloperOS Streamlit Suite Main Application Entrypoint.
Orchestrates tool navigation, category filtering, shared branding, and error isolation.
"""
import sys
from pathlib import Path
try:
import streamlit as st
except ImportError:
st = None
# Ensure project root is in sys.path
PROJECT_ROOT = Path(__file__).resolve().parent
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from tools import registry
from components.header import render_header
from components.footer import render_footer
from components.banner import render_main_promotional_banner
from components.navigation import render_tool_navigation
from components.related_tools import render_related_tools
from components.alerts import render_status_alert
# Streamlit Page Configuration
if st is not None:
st.set_page_config(
page_title="DeveloperOS Tools Suite",
page_icon="🛠️",
layout="wide",
initial_sidebar_state="expanded"
)
def load_suite_metadata() -> dict:
"""Safely loads suite metadata from manifest.yaml or defaults."""
manifest_path = PROJECT_ROOT / "manifest.yaml"
if manifest_path.exists():
try:
import yaml
with open(manifest_path, "r", encoding="utf-8") as f:
return yaml.safe_load(f) or {}
except Exception:
pass
return {
"name": "DeveloperOS Tools Suite",
"category": "Utilities",
"repository": "https://github.com/developerOSindia"
}
def main():
if st is None:
print("DeveloperOS Tools Suite: Streamlit is required to launch the interactive web UI.")
print("Install dependencies and run: pip install -r requirements.txt && streamlit run app.py")
return
metadata = load_suite_metadata()
suite_title = metadata.get("name", "DeveloperOS Tools Suite")
suite_category = metadata.get("category", "Utilities")
repo_url = metadata.get("repository", "https://github.com/developerOSindia")
# 1. Render Top Header
render_header(
suite_title=suite_title,
category_badge=suite_category,
github_repo=repo_url
)
# 2. Tool Navigation
all_tools = registry.list_all()
categories = registry.get_categories()
if not all_tools:
render_status_alert("No developer tools are currently registered in this suite.", "warning")
render_footer()
return
chosen_name, chosen_tool = render_tool_navigation(categories, all_tools)
if not chosen_tool:
st.info("Select a utility from the sidebar to begin.")
render_footer()
return
# 3. Safe Tool Execution
try:
chosen_tool.ui_entrypoint()
except Exception as exc:
render_status_alert(f"An unexpected error occurred while running {chosen_tool.name}: {exc}", "error")
# 4. Related Tools Recommendations
tool_lookup = {t.id: t for t in all_tools}
if chosen_tool.related_tools:
render_related_tools(chosen_tool.related_tools, tool_lookup)
# 5. Universal Promotional Banner (below primary tool interface)
render_main_promotional_banner(tool_name=chosen_tool.name)
# 6. Render Standard Footer Banner
render_footer()
if __name__ == "__main__":
main()