The javascript stuff in pyqtlet2 itself is easy enough. The command line option --collect-data=pyqtlet2 to PyInstaller is enough which corresponds to a hook which looks like:
# hook-pyqtlet2.py from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files("pyqtlet2")If you wanted to make this available to everyone, you could upload it to the hooks repo or you can store it in pyqtlet2.
What’s rather more fiddly is the dependency on qtpy. Because qtpy is an abstraction layer across the Qt variants, it contains conditional imports which PyInstaller’s dependency scanner has no idea how to handle. I don’t think there’s any way of making that issue invisible. If you put in explicit imports to a specific Qt variant before any qtpy or pyqtlet2 imports, it behaves itself. i.e. The hello world pyqtlet2 example becomes:
import sys import PyQt6.QtWebEngineWidgets # <--- This line is different from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget from pyqtlet2 import L, MapWidget class MapWindow(QWidget): def __init__(self): # Setting up the widgets and layout super().__init__() self.mapWidget = MapWidget() self.layout = QVBoxLayout() self.layout.addWidget(self.mapWidget) self.setLayout(self.layout) # Working with the maps with pyqtlet self.map = L.map(self.mapWidget) self.map.setView([12.97, 77.59], 10) L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map) self.marker = L.marker([12.934056, 77.610029]) self.marker.bindPopup('Maps are a treasure.') self.map.addLayer(self.marker) self.show() if __name__ == '__main__': app = QApplication(sys.argv) widget = MapWindow() sys.exit(app.exec_())