-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart_with_venv.py
More file actions
54 lines (43 loc) · 1.71 KB
/
start_with_venv.py
File metadata and controls
54 lines (43 loc) · 1.71 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
#!/usr/bin/env python3
"""
MUDP Chat Startup Script with Virtual Environment
This script validates the current interpreter before starting the app
"""
import sys
import importlib.util
from local_deps import bootstrap_local_dependency, ensure_dependency_version
bootstrap_local_dependency("meshdb")
bootstrap_local_dependency("mudp")
bootstrap_local_dependency("vnode")
ensure_dependency_version("meshdb", "0.2.0")
ensure_dependency_version("mudp", "1.5.7")
ensure_dependency_version("vnode", "0.1.10")
REQUIRED_RUNTIME_MODULES = ("meshdb", "mudp", "vnode")
def has_required_modules():
"""Check whether the active interpreter has the runtime dependencies we need."""
missing = [name for name in REQUIRED_RUNTIME_MODULES if importlib.util.find_spec(name) is None]
return (len(missing) == 0, missing)
def validate_current_environment():
"""Validate the currently selected interpreter instead of switching environments."""
ok, missing = has_required_modules()
if ok:
print(f"✅ Using interpreter: {sys.executable}")
return True
print(f"❌ Current interpreter is missing dependencies: {', '.join(missing)}")
print(f"Interpreter: {sys.executable}")
print("Install dependencies in this environment before launching Firefly.")
return False
def main():
print("🌐 MUDP Chat - Environment Startup")
print("=" * 50)
if not validate_current_environment():
sys.exit(1)
try:
from start import main as start_main
start_main()
except ImportError as e:
print(f"❌ Failed to import start module: {e}")
print("Make sure all dependencies are installed in the active environment")
sys.exit(1)
if __name__ == "__main__":
main()