Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy pyside2 applications? - The Qt way

I need to deploy a pyside2 application based on Qt 5.12.1 for all major 3 Operative Systems (Windows, Linux and MacOS).

I already checked on How to make a Python script standalone executable to run without ANY dependency? but that is not what I want because I need a Qt-related approach like windeployqt, macdeployqt, linuxdeployqt (separate project).

As pointed by eyllanesc: "python is a scripting language that does not generate a binary". However, the The Qt Company should figure that too and make easier for us to deploy pyside2 applications. At least as easier as deploying C++/QML applications.

So I want a tool like windowsdeployqt, macdeployqt, linuxdeployqt... That works with pyside2 applications.

[UPDATE] eyllanesc recommended fbs (fman build system) as a start point as there is not an official tool to deploy pyside2 applications. That should work as a workaround. New answers are welcome too.
Please answer as soon as possible when The Qt Company releases an official tool.

[NOTE]: I'm using Qt Creator 4.8.1 based on Qt 5.12.1

like image 993
lateus Avatar asked Apr 06 '19 01:04

lateus


People also ask

Can I use Qt Designer with PySide2?

PySide2 Tutorial — Creating applications with Qt Designer The good news is that Qt comes with a graphical editor — Qt Designer — which contains a drag-and-drop UI editor. Using Qt Designer you can define your UIs visually and then simply hook up the application logic later.

What is the difference between PyQt5 and PySide2?

The key difference in the two versions — in fact the entire reason PySide2 exists — is licensing. PyQt5 is available under a GPL or commercial license, and PySide2 under a LGPL license.

What version of Qt does PySide2 use?

PySide2 is the official Python module from the Qt for Python project, which provides access to the complete Qt 5.12+ framework.

What is Qt PySide?

PySide is a Python binding of the cross-platform GUI toolkit Qt developed by The Qt Company, as part of the Qt for Python project. It is one of the alternatives to the standard library package Tkinter. Like Qt, PySide is free software.


1 Answers

There is currently no Qt way to deploy PySide2 applications (and I do not think there will be any at least in the near future)

On this subject there are the following reports: PYSIDE-901, PYSIDE-913, in it this points out that possibly for Qt for Python 5.13 the documentation will be updated and there will be a section for the deployment. You can see the progress here.

See Deployment

In it 3 options to do deployment:

The options for a project are:

  1. Sending a normal zip-file with the application's content.
  2. Building a proper Python package(wheel): https://packaging.python.org
  3. Freezing the application in a single binary file, or into a directory.

And of the third method they comment on the pro and against of the tools like PyInstaller, cx_Freeze, py2exe and py2app indicating in the end that the best options for them is cx_Freeze or Pyinstaller. There is also another interesting tool that is the fbs project(based on Pyinstaller).

In my personal opinion I would choose fbs because it offers a simple way to package projects based on PyQt5 or PySide2

like image 50
eyllanesc Avatar answered Sep 19 '22 03:09

eyllanesc