Je suis en train d'utiliser le py2app construire un paquet d'applications avec PyQt5 et exclut modole inutile, cependant, je reçois toujours le paquet entier PyQt5 dans mon application qui est plus 200Mopy2app ne peut pas exclure le module correctement
from setuptools import setup
APP = ['browser.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'includes': ['PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWidgets'],
'excludes': ['PyQt5.QtDesigner', 'PyQt5.QtNetwork', 'PyQt5.QtOpenGL', 'PyQt5.QtScript', 'PyQt5.QtSql', 'PyQt5.QtTest','PyQt5.QtXml', 'PyQt5.QtHelp','QtHelp','QtSerialPort','QtHelp.so','PyQt5.QtHelp.so']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
et voici browser.py
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QMainWindow,QApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtWebEngineWidgets import QWebEngineView
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setWindowTitle('My Browser')
self.setWindowIcon(QIcon('icons/penguin.png'))
self.show()
self.browser = QWebEngineView()
url = 'https://www.google.com/'
self.browser.setUrl(QUrl(url))
self.setCentralWidget(self.browser)
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()
Merci!