Deployment#

Deploying or freezing an application is an important part of a Python project, this means to bundle all required resources so that the application finds everything it needs to be able to run on a client’s machine. However, because most large projects aren’t based on a single Python file, distributing these applications can be a challenge.

Here are a few distribution options that you can use:
  1. Send a normal ZIP file with the application’s content.

  2. Build a proper Python package (wheel).

  3. Freeze the application into a single binary file or directory.

  4. Provide native installer (msi, dmg)

If you are considering Option 3, then starting with 6.4, we ship a new tool called pyside6-deploy that deploys your PySide6 application to all desktop platforms - Windows, Linux, and macOS. To know more about how to use the tool see pyside6-deploy: the deployment tool for Qt for Python. For Android deployment, see pyside6-android-deploy: the Android deployment tool for Qt for Python. Additionally, you can also use other popular deployment tools shown below:

Although you can deploy PySide6 application using these tools, it is recommended to use pyside6-deploy as it is easier to use and also to get the most optimized executable. Since Qt for Python is a cross-platform framework, we focus on solutions for the three major platforms that Qt supports: Windows, Linux, and macOS.

The following table summarizes the platform support for those packaging tools:

Name License Qt 6 Qt 5 Linux macOS Windows

fbs

GPL

yes

yes

yes

yes

PyInstaller

GPL

partial

yes

yes

yes

yes

cx_Freeze

MIT

yes

yes

yes

yes

yes

py2exe

MIT

partial

partial

no

no

yes

py2app

MIT

yes

yes

no

yes

no

briefcase

BSD3

partial

yes

yes

yes

yes

Nuitka

MIT

yes

yes

yes

yes

yes

Notice that only fbs, cx_Freeze, briefcase, and PyInstaller meet our cross-platform requirement.

Since these are command-line tools, you’ll need special hooks or scripts to handle resources such as images, icons, and meta-information, before adding them to your package. Additionally, these tools don’t offer a mechanism to update your application packages.

To create update packages, use the PyUpdater, which is a tool built around PyInstaller.

The fbs tool offers a nice UI for the user to install the application step-by-step.

Note

Deployment is supported only from Qt for Python 5.12.2 and later.

Here’s a set of tutorials on how to use these tools: