-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.py
More file actions
54 lines (39 loc) · 1.68 KB
/
execute.py
File metadata and controls
54 lines (39 loc) · 1.68 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
"""Setup bootstrap for the graphify plugin.
Invoked from the Plugins UI to:
1. Install required Python dependencies (networkx, watchdog)
2. Report which optional capability tiers are available
3. Confirm the runtime can build graphs
Safe to re-run. Missing required deps are pip-installed; optional deps
are reported but never auto-installed, to avoid surprising users with
hundreds of megabytes of ML wheels.
"""
from __future__ import annotations
import sys
from pathlib import Path
_PROJECT_ROOT = Path(__file__).resolve().parents[3]
if str(_PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(_PROJECT_ROOT))
from usr.plugins.graphify.helpers.dependencies import ( # noqa: E402
ensure_required,
report_optional,
)
def main() -> int:
print("[Graphify] setup")
print("\n1. Required dependencies")
ok, still_missing = ensure_required(verbose=True)
if not ok:
print(f"[Graphify] still missing after install attempt: {', '.join(still_missing)}")
print("[Graphify] graphify will run with a degraded fallback graph and no live watcher")
# fall through — plugin can still operate minimally via in-tree fallback
print("\n2. Optional capability tiers")
optional = report_optional(verbose=True)
print("\n3. Capability check")
from usr.plugins.graphify.helpers.runtime import detect_capabilities # late import
capabilities = detect_capabilities()
for name, enabled in capabilities.items():
status = "enabled" if enabled else "missing optional dependencies"
print(f" - {name}: {status}")
print("\n[Graphify] setup complete")
return 0 if ok else 1
if __name__ == "__main__":
raise SystemExit(main())