-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathClaudeWorld.spec
More file actions
233 lines (210 loc) · 6.5 KB
/
Copy pathClaudeWorld.spec
File metadata and controls
233 lines (210 loc) · 6.5 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# -*- mode: python ; coding: utf-8 -*-
"""
PyInstaller spec file for ClaudeWorld.
This bundles the FastAPI backend with the pre-built React frontend
into a single Windows executable.
Build command: pyinstaller ClaudeWorld.spec
"""
import os
import sys
from pathlib import Path
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
# Version info for Windows executable (helps with SmartScreen/antivirus)
VERSION = '1.0.0.0'
version_tuple = tuple(map(int, VERSION.split('.')))
# Only create version info on Windows
if sys.platform == 'win32':
from PyInstaller.utils.win32.versioninfo import (
VSVersionInfo, FixedFileInfo, StringFileInfo, StringTable, StringStruct, VarFileInfo, VarStruct
)
version_info = VSVersionInfo(
ffi=FixedFileInfo(
filevers=version_tuple,
prodvers=version_tuple,
mask=0x3f,
flags=0x0,
OS=0x40004, # VOS_NT_WINDOWS32
fileType=0x1, # VFT_APP
subtype=0x0,
),
kids=[
StringFileInfo([
StringTable('040904B0', [ # US English, Unicode
StringStruct('CompanyName', 'ClaudeWorld'),
StringStruct('FileDescription', 'ClaudeWorld - AI-powered text adventure'),
StringStruct('FileVersion', VERSION),
StringStruct('InternalName', 'ClaudeWorld'),
StringStruct('LegalCopyright', 'MIT License'),
StringStruct('OriginalFilename', 'ClaudeWorld.exe'),
StringStruct('ProductName', 'ClaudeWorld'),
StringStruct('ProductVersion', VERSION),
])
]),
VarFileInfo([VarStruct('Translation', [0x0409, 0x04B0])]) # US English, Unicode
]
)
else:
version_info = None
# Get the project root directory
project_root = Path(SPECPATH)
backend_dir = project_root / 'backend'
frontend_dist = project_root / 'frontend' / 'dist'
agents_dir = project_root / 'agents'
config_dir = backend_dir / 'sdk' / 'config'
# Data files to include
logging_config_dir = backend_dir / 'infrastructure' / 'logging'
assets_dir = project_root / 'assets'
datas = [
# Frontend static files
(str(frontend_dist), 'static'),
# Agent configurations
(str(agents_dir), 'agents'),
# Backend config files (YAML)
(str(config_dir), 'backend/sdk/config'),
# Logging/debug config
(str(logging_config_dir), 'backend/infrastructure/logging'),
# Application icon (for pywebview window)
(str(assets_dir / 'icon.ico'), 'assets'),
# .env.example as template
(str(project_root / '.env.example'), '.'),
]
# Collect ruamel.yaml data files (required for proper YAML handling)
datas += collect_data_files('ruamel.yaml')
# Collect all ruamel.yaml submodules
ruamel_hiddenimports = collect_submodules('ruamel.yaml')
# Collect local backend modules dynamically
def collect_backend_modules(backend_path):
"""Find all Python modules in the backend directory."""
modules = []
for root, dirs, files in os.walk(backend_path):
# Skip __pycache__ and test directories
dirs[:] = [d for d in dirs if d not in ('__pycache__', 'tests', '.pytest_cache')]
rel_path = os.path.relpath(root, backend_path)
if rel_path == '.':
package = ''
else:
package = rel_path.replace(os.sep, '.')
for file in files:
if file.endswith('.py') and not file.startswith('test_'):
module_name = file[:-3] # Remove .py extension
if package:
full_module = f'{package}.{module_name}'
else:
full_module = module_name
modules.append(full_module)
return modules
backend_modules = collect_backend_modules(backend_dir)
# Hidden imports that PyInstaller might miss
hiddenimports = [
# Local backend modules
*backend_modules,
# ruamel.yaml submodules (collected dynamically)
*ruamel_hiddenimports,
# Uvicorn internals
'uvicorn.logging',
'uvicorn.loops',
'uvicorn.loops.auto',
'uvicorn.protocols',
'uvicorn.protocols.http',
'uvicorn.protocols.http.auto',
'uvicorn.protocols.websockets',
'uvicorn.protocols.websockets.auto',
'uvicorn.lifespan',
'uvicorn.lifespan.on',
'uvicorn.lifespan.off',
# Database
'sqlalchemy.dialects.sqlite',
'sqlalchemy.dialects.postgresql',
'aiosqlite',
'asyncpg',
# Auth
'bcrypt',
'jwt', # PyJWT package
# Claude Agent SDK
'claude_agent_sdk',
'claude_agent_sdk.client',
'mcp',
'mcp.types',
# HTTP clients
'httpx',
'httpcore',
'anyio',
'anyio._backends',
'anyio._backends._asyncio',
'sniffio',
'h11',
'certifi',
# APScheduler
'apscheduler.triggers.interval',
'apscheduler.triggers.cron',
'apscheduler.schedulers.asyncio',
'apscheduler.schedulers.background',
'apscheduler.jobstores.memory',
'apscheduler.executors.pool',
# YAML
'ruamel.yaml',
'ruamel.yaml.clib',
# Web framework
'slowapi',
'starlette.responses',
'starlette.staticfiles',
# Pydantic
'pydantic',
'pydantic_core',
'email_validator',
# Python-dotenv
'dotenv',
# Image processing
'PIL',
'PIL.Image',
# FastAPI MCP
'fastapi_mcp',
# pywebview (native window)
'webview',
]
# Collect pywebview submodules for the active platform
webview_hiddenimports = collect_submodules('webview')
hiddenimports += webview_hiddenimports
a = Analysis(
[str(backend_dir / 'launcher.py')],
pathex=[str(backend_dir)],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
'tkinter',
'matplotlib',
'numpy',
'pandas',
'scipy',
'cv2',
],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='ClaudeWorld',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True, # Needed for first-time setup wizard; hidden programmatically after startup
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=str(assets_dir / 'icon.ico') if (assets_dir / 'icon.ico').exists() else None,
version=version_info, # Windows version info (reduces SmartScreen warnings)
)