test/moxie/build.py
Z User 1f9535d683 Add complete MOXIE web UI with authentication and user management
- New web UI with OpenWebUI-like interface using Tailwind CSS
- SQLite-based authentication with session management
- User registration, login, and profile pages
- Chat interface with conversation history
- Streaming responses with visible thinking phase
- File attachments support
- User document uploads in profile
- Rate limiting (5 requests/day for free users)
- Admin panel user management with promote/demote/delete
- Custom color theme matching balloon logo design
- Compatible with Nuitka build system
2026-03-24 05:15:50 +00:00

114 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""
MOXIE Build Script
Builds a standalone executable using Nuitka.
"""
import subprocess
import sys
import os
from pathlib import Path
# Project root
PROJECT_ROOT = Path(__file__).parent
# Build configuration
BUILD_CONFIG = {
"main_module": "main.py",
"output_filename": "moxie",
"packages": [
"fastapi",
"uvicorn",
"pydantic",
"pydantic_settings",
"ollama",
"httpx",
"aiohttp",
"duckduckgo_search",
"wikipedia",
"jinja2",
"pypdf",
"docx",
"bs4",
"loguru",
"websockets",
"numpy",
"starlette",
"anyio",
"httptools",
"python_multipart",
],
"include_data_dirs": [
("admin/templates", "admin/templates"),
("admin/static", "admin/static"),
("web/templates", "web/templates"),
("web/static", "web/static"),
],
"include_data_files": [
("moxie_logo.jpg", "moxie_logo.jpg"),
],
}
def build():
"""Build the executable using Nuitka."""
print("=" * 60)
print("MOXIE Build Script")
print("=" * 60)
# Change to project directory
os.chdir(PROJECT_ROOT)
# Build command
cmd = [
sys.executable,
"-m",
"nuitka",
"--standalone",
"--onefile",
"--onefile-no-compression",
"--assume-yes-for-downloads",
f"--output-filename={BUILD_CONFIG['output_filename']}",
"--enable-plugin=multiprocessing",
]
# Add packages
for pkg in BUILD_CONFIG["packages"]:
cmd.append(f"--include-package={pkg}")
# Add data directories
for src, dst in BUILD_CONFIG["include_data_dirs"]:
src_path = PROJECT_ROOT / src
if src_path.exists():
cmd.append(f"--include-data-dir={src}={dst}")
# Add data files
for src, dst in BUILD_CONFIG.get("include_data_files", []):
src_path = PROJECT_ROOT / src
if src_path.exists():
cmd.append(f"--include-data-file={src}={dst}")
# Add main module
cmd.append(BUILD_CONFIG["main_module"])
print("\nRunning Nuitka build...")
print(" ".join(cmd[:10]), "...")
print()
# Run build
result = subprocess.run(cmd, cwd=PROJECT_ROOT)
if result.returncode == 0:
print("\n" + "=" * 60)
print("BUILD SUCCESSFUL!")
print(f"Executable: {BUILD_CONFIG['output_filename']}")
print("=" * 60)
else:
print("\n" + "=" * 60)
print("BUILD FAILED!")
print("=" * 60)
sys.exit(1)
if __name__ == "__main__":
build()