The Command Line

pyqtdeploy

pyqtdeploy takes a single optional argument which is the name of a project file to edit as follows:

pyqtdeploy myproject.pdy

By convention project files have a .pdy extension.

This will open the myproject.pdy project creating it if necessary.

pyqtdeploycli

pyqtdeploycli implements a number of modes of operation that are usually used in automated build scripts. These modes are invoked by specifying an action as the only positional argument on the command line. The behaviour of an action may be modified by additional command line options.

The supported actions are:

build

This will build all the source code, include the qmake .pro files, needed to create the application. The next step in the full build process would be to run qmake.

configure

This will create a configuration file for compiling a particular package for a particular target platform. The configuration file is used by the package’s build system to create the package’s Python bindings.

Configuration files are intended as a basis which will be fine for most cases. However you should check that they are appropriate for your particular case and modify them if necessary.

install

New in version 1.2.

This will compile (if necessary) and install a particular package for a particular target platform. It is assumed that the recommended directory structure described in Choosing a Directory Structure is being used.

At the moment only the python package for the win target is supported. It is assumed that you have installed Python using one of the Windows installers from python.org.

show-packages

This will display a list of packages that pyqtdeploycli can create configuration files for.

show-targets

This will display a list of targets that pyqtdeploycli can create configuration files for.

show-version

This will display the version number.

The full set of command line options is:

-h, --help

This will display a summary of the command line actions and options.

--android-api LEVEL

New in version 1.3.

When used with the configure action to configure the python package for the android target this specifies the Android API level. The default value is obtained from the value of the ANDROID_NDK_PLATFORM environment variable. If this is not set then 9 is used which is the default level used by Qt.

--disable-patches

New in version 1.2.

When used with the configure action to configure the python package this specifies that the Python source code will not be patched. The default is to enable the patching of the Python source code for Android based targets. Use this option when you want to apply your own set of patches, or if you are using an NDK (such as CrystaX NDK) that doesn’t require the Python source code to be patched at all.

--enable-dynamic-loading

When used with the configure action to configure the python package this specifies that the Python interpreter will have dynamic loading enabled. The default is to disable dynamic loading.

--include-dir

New in version 1.2.

When used with the build action this specifies the name of the directory containing the target Python installation’s Python.h file. It overrides any value specified in the project file.

--interpreter

New in version 1.2.

When used with the build action this specifies the host Python interpreter used to compile all of the Python modules used by the application. It overrides any value specified in the project file.

--opt LEVEL

When used with the build action this specifies the level of optimisation performed when freezing Python source files:

0 - no optimisation is done

1 - assert statements are removed

2 - assert statements and docstrings are removed.

The default is 2.

--output OUTPUT

When used with the build action this specifies the name of the build directory where all the application source code will be placed. By default the directory defined in the project file is used.

When used with the configure action this specifies the name of the configuration file that is created. By default the file is called package-target.cfg (where package is the name of the package and target is the name of the target platform) and placed in the current directory.

--package PACKAGE

This is required by the configure and install actions to specify the package.

--project FILE

This is required by the build action to specify the project file.

--python-library

New in version 1.2.

When used with the build action this specifies the name of the target Python interpreter library. It overrides any value specified in the project file.

--resources NUMBER

When used with the build action this specifies the number of Qt .qrc resource files that are generated. On Windows, MSVC cannot cope with very large resource files and complains of a lack of heap space. If you run into this problem then try increasing the the number of resource files generated.

--source-dir

New in version 1.2.

When used with the build action this specifies the name of the directory containing the Python source code. It overrides any value specified in the project file.

--standard-library-dir

New in version 1.2.

When used with the build action this specifies the name of the directory containing the target Python interpreter’s standard library. It overrides any value specified in the project file.

--sysroot

New in version 1.2.

When used with the install action this specifies the name of the system image root directory as recommended in Choosing a Directory Structure.

--system-python VERSION

New in version 1.2.

When used with the install action to install the python package this specifies the version number of Python to use. Only the major and minor version numbers need be specified (e.g. 3.5).

--target TARGET

This is used with the configure and install actions to specify the target platform. By default the host platform is used. The full target consists of the base target and an optional target variant (usually related to the target’s word size). The supported base targets are linux, win, osx, ios and android. The show-targets action will list the supported targets including the target variants.

--quiet

This is used with the build action to specify that progress messages should be disabled.

--verbose

This is used with the build action to specify that additional progress messages should be enabled.

Examples

pyqtdeploycli --output /tmp/build --project myproject.pdy --quiet build

The code for the application described by the myproject.pdy project file will be created in the /tmp/build directory. All progress messages will be disabled.

pyqtdeploycli --package pyqt5 configure

If this command was run on a Linux system then a configuration file for building PyQt5 for Linux, called pyqt5-linux.cfg, would be created in the current directory.

pyqtdeploycli --package pyqt4 --target android configure

A configuration file for building PyQt4 for Android, called pyqt4-android.cfg will be created in the current directory.

pyqtdeploycli --output /tmp/pyqt.config --package pyqt5 --target ios configure

A configuration file for building PyQt5 for iOS, called pyqt.config will be created in the /tmp directory.