An Overview of the Deployment Process

The purpose of pyqtdeploy is to convert a Python application, the Python interpreter, the Python standard library, Python C extension modules, third-party Python packages and third-party extension modules to a single, target-specific executable. Depending on the target the executable may need to be packaged in some way to be truly deployable. For example, Android applications need to be signed and packaged as a .apk file. Any such packaging is outside the scope of pyqtdeploy.

While pyqtdeploy allows you to create a single executable you are free to keep components external to the executable if required.

pyqtdeploy supports the following target architectures:

  • android-32

  • android-64

  • ios-64

  • linux-64

  • macos-64

  • win-32

  • win-64.

The full architecture name consists of the platform and the word size separated by a -. Note that not all platform/word size combinations are supported.

pyqtdeploy uses the following parts of Qt:

  • qmake is the Qt build system that supports cross-compilation to multiple targets.

  • rcc is a utility that converts arbitrary files to C++ data structures that implement an embedded filesystem that can be linked as part of an application.

  • The QtCore library implements file access APIs that recognise file and directory names that refer to the contents of the embedded filesystem created with rcc. pyqtdeploy implements import hooks that use QtCore so that frozen Python modules can be imported from the embedded filesystem just as if they were being imported from an ordinary filesystem.

Note that pyqtdeploy generated code does not itself use PyQt. pyqtdeploy can be used to deploy non-PyQt applications, including simple command line scripts. However, as every deployed application is linked with the QtCore library, you should make sure that your application’s license is compatible with the license of the version of Qt that you are using.

The steps required to develop a deployable application are as follows:

  • Develop and test the application as normal using a native Python installation containing the required third-party components.

  • Create a sysroot specification file, typically called sysroot.toml, that identifies the components (and their exact version numbers) that are required. See Building a System Root Directory to learn how to do this. pyqtdeploy-sysroot can be used to verify the specification file, i.e. that all component versions are mutually compatible. At this stage it is not necessary to actually build the sysroot. It is common practice to use the same sysroot for several applications.

  • Create a project file for the application that identifies the application’s source code and all the Python packages and extension modules it uses. See Creating a pyqtdeploy Project to learn how to use pyqtdeploy to do this.

  • Use pyqtdeploy-sysroot to build the target-specific sysroot from its specification file if it has not already been done.

  • Freeze the Python modules and generate a qmake .pro file in a target-specific build directory. The .pro file will reference all of the required components in the associated sysroot. Run qmake and then make to create the application executable. See Building the Application to learn how to use pyqtdeploy-build to do this.