-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyQuantLab_Qt.spec
More file actions
155 lines (145 loc) · 3.86 KB
/
Copy pathPyQuantLab_Qt.spec
File metadata and controls
155 lines (145 loc) · 3.86 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
# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller spec for PyQuantLab Qt desktop version."""
import os
import site
PROJECT_DIR = SPECPATH # noqa: F821
site_packages = site.getsitepackages()[0]
# Collect project Python modules
added_files = []
for root, dirs, files in os.walk(PROJECT_DIR):
for f in files:
if f.endswith('.py') and f != 'PyQuantLab_Qt.spec' and f != 'PyQuantLab.spec' \
and 'runtime_hook.py' not in f:
if '__pycache__' in root:
continue
full = os.path.join(root, f)
rel_dir = os.path.relpath(os.path.dirname(full), PROJECT_DIR)
added_files.append((full, rel_dir))
# Include Qt platform plugin (critical for PyQt5 exe)
qt_plugin_dir = None
for p in site.getsitepackages():
candidate = os.path.join(p, 'PyQt5', 'Qt5', 'plugins')
if os.path.isdir(candidate):
qt_plugin_dir = candidate
break
if qt_plugin_dir:
added_files.append((os.path.join(qt_plugin_dir, 'platforms'), 'platforms'))
added_files.append((os.path.join(qt_plugin_dir, 'styles'), 'styles'))
a = Analysis(
['launcher_qt.py'],
pathex=[],
binaries=[],
datas=added_files,
hiddenimports=[
'PyQt5',
'PyQt5.QtCore',
'PyQt5.QtGui',
'PyQt5.QtWidgets',
'PyQt5.sip',
'matplotlib',
'matplotlib.backends.backend_qt5agg',
'matplotlib.figure',
'matplotlib.colors',
'matplotlib.cm',
'PIL',
'PIL.Image',
'PIL.ImageColor',
'pandas',
'numpy',
'numpy.core',
'numpy.linalg',
'numpy.random',
'yfinance',
'scipy',
'scipy.optimize',
'scipy.optimize._minimize',
'scipy.linalg',
# ---- 数据源(ETF/成分股行情,A 股)----
'akshare',
'akshare.stock',
'curl_cffi',
'mini_racer',
'peewee',
'websockets',
'jsonpath',
'xlrd',
'multitasking',
],
hookspath=[],
hooksconfig={},
runtime_hooks=[os.path.join(PROJECT_DIR, 'runtime_hook_common.py')],
excludes=[
'tkinter',
'streamlit',
'tornado',
'altair',
'pydeck',
'plotly',
'IPython',
'jupyter',
'notebook',
'sqlalchemy',
# 排除多余 Qt 绑定,防止与 PyQt5 冲突
'PySide6',
'PySide2',
'PyQt6',
'shiboken6',
'shiboken2',
# ---- 方案 B 拆分:ML/DL 已独立为 ml-trainer exe,主程序不含 ----
'torch',
'torchvision',
'torchaudio',
'lightgbm',
'sklearn',
'numba',
'llvmlite',
# ---- akshare 链冗余可视化/工具库(常用接口不依赖)----
'panel',
'bokeh',
'holoviews',
'param',
'pyviz',
'botocore',
'boto3',
'cv2',
'skimage',
'sphinx',
'statsmodels',
# QtWebEngine(桌面版不用浏览器内核,省 ~112MB)
'PyQt5.QtWebEngineWidgets',
'PyQt5.QtWebEngineCore',
'PyQt5.QtWebEngine',
],
noarchive=False,
)
# ---- 方案 A 共享 DLL:mkl 全套移出 exe 目录,运行时从 dist/PyQuantLab_common/ 加载 ----
a.binaries = [b for b in a.binaries if not (b[0].startswith("mkl_") and b[0].endswith(".dll"))]
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
a.zipfiles,
name='PyQuantLab',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='E:\\lianghua1\\xunzong.ico',
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='PyQuantLab',
)