feat: add PyInstaller build for standalone binary distribution
- Add PyInstaller spec file and build script for creating standalone executables - Add install.sh for curl | sh installation from GitHub releases - Add GitHub Actions workflow for multi-platform builds (macOS, Linux, Windows) - Move sandbox-only deps (playwright, ipython, libtmux, etc.) to optional extras - Make google-cloud-aiplatform optional ([vertex] extra) to reduce binary size - Use lazy imports in tool actions to avoid loading sandbox deps at startup - Add -v/--version flag to CLI - Add website and Discord links to completion message - Binary size: ~97MB (down from ~120MB with all deps)
This commit is contained in:
221
strix.spec
Normal file
221
strix.spec
Normal file
@@ -0,0 +1,221 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
||||
|
||||
project_root = Path(SPECPATH)
|
||||
strix_root = project_root / 'strix'
|
||||
|
||||
datas = []
|
||||
|
||||
for jinja_file in strix_root.rglob('*.jinja'):
|
||||
rel_path = jinja_file.relative_to(project_root)
|
||||
datas.append((str(jinja_file), str(rel_path.parent)))
|
||||
|
||||
for xml_file in strix_root.rglob('*.xml'):
|
||||
rel_path = xml_file.relative_to(project_root)
|
||||
datas.append((str(xml_file), str(rel_path.parent)))
|
||||
|
||||
for tcss_file in strix_root.rglob('*.tcss'):
|
||||
rel_path = tcss_file.relative_to(project_root)
|
||||
datas.append((str(tcss_file), str(rel_path.parent)))
|
||||
|
||||
datas += collect_data_files('textual')
|
||||
|
||||
datas += collect_data_files('tiktoken')
|
||||
datas += collect_data_files('tiktoken_ext')
|
||||
|
||||
datas += collect_data_files('litellm')
|
||||
|
||||
hiddenimports = [
|
||||
# Core dependencies
|
||||
'litellm',
|
||||
'litellm.llms',
|
||||
'litellm.llms.openai',
|
||||
'litellm.llms.anthropic',
|
||||
'litellm.llms.vertex_ai',
|
||||
'litellm.llms.bedrock',
|
||||
'litellm.utils',
|
||||
'litellm.caching',
|
||||
|
||||
# Textual TUI
|
||||
'textual',
|
||||
'textual.app',
|
||||
'textual.widgets',
|
||||
'textual.containers',
|
||||
'textual.screen',
|
||||
'textual.binding',
|
||||
'textual.reactive',
|
||||
'textual.css',
|
||||
'textual._text_area_theme',
|
||||
|
||||
# Rich console
|
||||
'rich',
|
||||
'rich.console',
|
||||
'rich.panel',
|
||||
'rich.text',
|
||||
'rich.markup',
|
||||
'rich.style',
|
||||
'rich.align',
|
||||
'rich.live',
|
||||
|
||||
# Pydantic
|
||||
'pydantic',
|
||||
'pydantic.fields',
|
||||
'pydantic_core',
|
||||
'email_validator',
|
||||
|
||||
# Docker
|
||||
'docker',
|
||||
'docker.api',
|
||||
'docker.models',
|
||||
'docker.errors',
|
||||
|
||||
# HTTP/Networking
|
||||
'httpx',
|
||||
'httpcore',
|
||||
'requests',
|
||||
'urllib3',
|
||||
'certifi',
|
||||
|
||||
# Jinja2 templating
|
||||
'jinja2',
|
||||
'jinja2.ext',
|
||||
'markupsafe',
|
||||
|
||||
# XML parsing
|
||||
'xmltodict',
|
||||
|
||||
# Tiktoken (for token counting)
|
||||
'tiktoken',
|
||||
'tiktoken_ext',
|
||||
'tiktoken_ext.openai_public',
|
||||
|
||||
# Tenacity retry
|
||||
'tenacity',
|
||||
|
||||
# Strix modules
|
||||
'strix',
|
||||
'strix.interface',
|
||||
'strix.interface.main',
|
||||
'strix.interface.cli',
|
||||
'strix.interface.tui',
|
||||
'strix.interface.utils',
|
||||
'strix.interface.tool_components',
|
||||
'strix.agents',
|
||||
'strix.agents.base_agent',
|
||||
'strix.agents.state',
|
||||
'strix.agents.StrixAgent',
|
||||
'strix.llm',
|
||||
'strix.llm.llm',
|
||||
'strix.llm.config',
|
||||
'strix.llm.utils',
|
||||
'strix.llm.request_queue',
|
||||
'strix.llm.memory_compressor',
|
||||
'strix.runtime',
|
||||
'strix.runtime.runtime',
|
||||
'strix.runtime.docker_runtime',
|
||||
'strix.telemetry',
|
||||
'strix.telemetry.tracer',
|
||||
'strix.tools',
|
||||
'strix.tools.registry',
|
||||
'strix.tools.executor',
|
||||
'strix.tools.argument_parser',
|
||||
'strix.prompts',
|
||||
]
|
||||
|
||||
hiddenimports += collect_submodules('litellm')
|
||||
hiddenimports += collect_submodules('textual')
|
||||
hiddenimports += collect_submodules('rich')
|
||||
hiddenimports += collect_submodules('pydantic')
|
||||
|
||||
excludes = [
|
||||
# Sandbox-only packages
|
||||
'playwright',
|
||||
'playwright.sync_api',
|
||||
'playwright.async_api',
|
||||
'IPython',
|
||||
'ipython',
|
||||
'libtmux',
|
||||
'pyte',
|
||||
'openhands_aci',
|
||||
'openhands-aci',
|
||||
'gql',
|
||||
'fastapi',
|
||||
'uvicorn',
|
||||
'numpydoc',
|
||||
|
||||
# Google Cloud / Vertex AI
|
||||
'google.cloud',
|
||||
'google.cloud.aiplatform',
|
||||
'google.api_core',
|
||||
'google.auth',
|
||||
'google.oauth2',
|
||||
'google.protobuf',
|
||||
'grpc',
|
||||
'grpcio',
|
||||
'grpcio_status',
|
||||
|
||||
# Test frameworks
|
||||
'pytest',
|
||||
'pytest_asyncio',
|
||||
'pytest_cov',
|
||||
'pytest_mock',
|
||||
|
||||
# Development tools
|
||||
'mypy',
|
||||
'ruff',
|
||||
'black',
|
||||
'isort',
|
||||
'pylint',
|
||||
'pyright',
|
||||
'bandit',
|
||||
'pre_commit',
|
||||
|
||||
# Unnecessary for runtime
|
||||
'tkinter',
|
||||
'matplotlib',
|
||||
'numpy',
|
||||
'pandas',
|
||||
'scipy',
|
||||
'PIL',
|
||||
'cv2',
|
||||
]
|
||||
|
||||
a = Analysis(
|
||||
['strix/interface/main.py'],
|
||||
pathex=[str(project_root)],
|
||||
binaries=[],
|
||||
datas=datas,
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=excludes,
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='strix',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=False,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
Reference in New Issue
Block a user