11# Add folders you want to bundle
22import os
33from PyInstaller .building .build_main import Analysis , PYZ , EXE , COLLECT , Tree
4+ from config import USE_FASTPLOTLIB
45
56block_cipher = None
67
@@ -10,16 +11,71 @@ proj_root = os.path.abspath(os.getcwd())
1011# Entry point of your app:
1112entry_script = os .path .join (proj_root , "SerialUI.py" )
1213
14+ datas = [
15+ ("assets" , "assets" ),
16+ ("README.md" , "." ),
17+ ]
18+
19+ excludes = [
20+ # Ensure only PyQt6 is collected. The source contains PyQt5 fallback imports,
21+ # but frozen builds should ship exactly one Qt binding.
22+ "PyQt5" ,
23+ "PyQt5.sip" ,
24+ "PySide2" ,
25+ "PySide6" ,
26+ # Exclude GUI stacks not used by this Qt app.
27+ "IPython" ,
28+ "ipykernel" ,
29+ "gi" ,
30+ "gi.repository" ,
31+ "tkinter" ,
32+ "PIL.ImageTk" ,
33+ # Avoid GTK/Tk backend pull-in from matplotlib in frozen Qt app.
34+ "matplotlib" ,
35+ "matplotlib.backends.backend_gtk3" ,
36+ "matplotlib.backends.backend_gtk3agg" ,
37+ "matplotlib.backends.backend_gtk3cairo" ,
38+ "matplotlib.backends.backend_gtk4" ,
39+ "matplotlib.backends.backend_gtk4agg" ,
40+ "matplotlib.backends.backend_gtk4cairo" ,
41+ "matplotlib.backends.backend_tkagg" ,
42+ "matplotlib.backends.backend_tkcairo" ,
43+ ]
44+
45+ # In default config we do not use fastplotlib. Exclude its heavy dependency stack
46+ # to prevent multi-GB Linux bundles from optional CUDA/OpenCV/media packages.
47+ if not USE_FASTPLOTLIB :
48+ excludes += [
49+ "fastplotlib" ,
50+ "pygfx" ,
51+ "wgpu" ,
52+ "rendercanvas" ,
53+ "imgui_bundle" ,
54+ "cv2" ,
55+ "imageio" ,
56+ "imageio_ffmpeg" ,
57+ "av" ,
58+ "uharfbuzz" ,
59+ "wx" ,
60+ "vtk" ,
61+ "pandas" ,
62+ "scipy" ,
63+ "dask" ,
64+ "zarr" ,
65+ "numcodecs" ,
66+ "h5py" ,
67+ "botocore" ,
68+ "sphinx" ,
69+ "pytest" ,
70+ "numba" ,
71+ "llvmlite" ,
72+ ]
1373
1474a = Analysis (
1575 [entry_script ],
1676 pathex = [proj_root ],
1777 binaries = [],
18- datas = [
19- ("assets" , "assets" ),
20- ("docs" , "docs" ),
21- ("helpers" , "helpers" ),
22- ],
78+ datas = datas ,
2379 hiddenimports = [
2480 # Add any modules here that PyInstaller might miss, e.g.:
2581 # "pkg_resources.py2_warn",
@@ -33,30 +89,7 @@ a = Analysis(
3389 "gi" : {"icons" : [], "themes" : [], "languages" : []},
3490 },
3591 runtime_hooks = [],
36- # Ensure only PyQt6 is collected. The source contains PyQt5 fallback imports,
37- # but frozen builds should ship exactly one Qt binding.
38- excludes = [
39- "PyQt5" ,
40- "PyQt5.sip" ,
41- "PySide2" ,
42- "PySide6" ,
43- # Exclude GUI stacks not used by this Qt app.
44- "IPython" ,
45- "ipykernel" ,
46- "gi" ,
47- "gi.repository" ,
48- "tkinter" ,
49- "PIL.ImageTk" ,
50- # Avoid GTK backend pull-in from matplotlib in frozen Qt app.
51- "matplotlib.backends.backend_gtk3" ,
52- "matplotlib.backends.backend_gtk3agg" ,
53- "matplotlib.backends.backend_gtk3cairo" ,
54- "matplotlib.backends.backend_gtk4" ,
55- "matplotlib.backends.backend_gtk4agg" ,
56- "matplotlib.backends.backend_gtk4cairo" ,
57- "matplotlib.backends.backend_tkagg" ,
58- "matplotlib.backends.backend_tkcairo" ,
59- ],
92+ excludes = excludes ,
6093 win_no_prefer_redirects = False ,
6194 win_private_assemblies = False ,
6295 cipher = block_cipher ,
@@ -77,7 +110,7 @@ exe = EXE(
77110 name = "SerialUI" ,
78111 debug = False ,
79112 bootloader_ignore_signals = False ,
80- strip = False ,
113+ strip = True ,
81114 upx = True ,
82115 console = False , # set False if you want a pure GUI app (no console window)
83116 icon = os .path .join ("assets" , "icon_96.ico" ),
@@ -88,7 +121,7 @@ coll = COLLECT(
88121 a .binaries ,
89122 a .zipfiles ,
90123 a .datas ,
91- strip = False ,
124+ strip = True ,
92125 upx = True ,
93126 upx_exclude = [],
94127 name = "SerialUI" ,
0 commit comments