I'm using Pyinstaller to generate an executable of a Python3 application that includes a UI made with PySide2.
Using using the --onefile flag the resulting .exe is huge,140 MB.
I tried generating without --onefile flag and take a look what was included in the dist folder: to my surprise everything from PySide2 was included, hence the size.
Keeping in mind that I imported only a few thing from PySide2 (namely: QDialog, QLabel, QPushButton, QApplication, QVBoxLayout) I proceded to manually delete clearly unnecessary files (i.e. QtBluetooth, QtCharts...) and the main executable still works perfectly.
Is there a way to either:
a. proceed to generate the single file executable after the manual removal of unneccessary files
or
b. specify exactly what from PySide should be packed?
The import in the Python script looks like from PySide2.QtWidgets import QDialog, QLabel, QPushButton, QApplication, QVBoxLayout
but everything is being packed instead.