Difference between revisions of "Qt for Python/GettingStarted"

From Qt Wiki
Jump to: navigation, search
m
Line 7: Line 7:
 
=== Development ===
 
=== Development ===
  
Development happens in the dev branches of the [http://code.qt.io/cgit/pyside/pyside-setup.git/ repositories]. Contributions follow the [[Qt_Project_Guidelines|standard process]].  
+
Development happens in the dev branches of the [http://code.qt.io/cgit/pyside/pyside-setup.git/ repositories]. The top level repository has several submodules:
 +
* sources/shiboken2: [http://code.qt.io/cgit/pyside/shiboken.git/ Shiboken Parser]
 +
* sources/pyside2: [http://code.qt.io/cgit/pyside/pyside.git/ PySide 2]
 +
* sources/pyside2-examples: [http://code.qt.io/cgit/pyside/examples.git/ Examples]
 +
* sources/pyside2-tools: uic, rcc
 +
* wiki: Wiki
 +
 
 +
Contributions follow the [[Qt_Project_Guidelines|standard process]].  
  
 
Building requires [https://cmake.org/ CMake].  
 
Building requires [https://cmake.org/ CMake].  
Line 25: Line 32:
 
or
 
or
 
  CALL testenv\Scripts\activate.bat
 
  CALL testenv\Scripts\activate.bat
 +
 +
=== Building PySide2 ===
 +
 +
The script ''setup.py'' is used to build and install PySide2 package. It takes a mode argument (''build'' or ''install'') and several options.
 +
 +
Required options:
 +
* --qmake=<binary> Path to ''qmake'' of the Qt library to be used
 +
* --cmake=<binary> Path to ''cmake''
 +
 +
Further options of interest:
 +
* ---ignore-git: Prevents ''setup.py'' from cloning and checking out the submodules.
 +
* --build-tests: Creates a directory containing the tests along with some helper packages
 +
* --debug: Build in Debug mode
 +
* --openssl: Path to OpenSSL
 +
 +
A typical invokation looks like:
 +
setup.py install ---ignore-git --build-tests --qmake=../bin/qmake --cmake=/usr/bin/cmake

Revision as of 12:47, 29 August 2016

Considerations before starting

PySide2 supports Python 2 (recommended: 2.7 onwards, Compatibility module six installed) and Python 3 (recommended: 3.5 onwards).

Currently, only Qt 5.6 is supported. Qt needs to be build with the QtXmlPatterns module.

Development

Development happens in the dev branches of the repositories. The top level repository has several submodules:

Contributions follow the standard process.

Building requires CMake.

It is helpful to have debug binaries and/or symbols for Python available. On Windows, this is done choosing Customized Installation when installing python and ticking the respective check boxes. On Linux, debug packages can be installed in addition. For Ubuntu, the packages python3-dbg, libpython3-dbg provide a debug binary python3-dbg.

It is also recommended to use a Virtual Environment for testing to be able to always start from a clean base and avoid issues with write permissions in installations.

On Linux, the command

virtualenv -p /usr/bin/python3-dbg testenv

creates a Virtual Environment named testenv for debugging purposes. On Windows, an installation step may be required:

python -m pip install virtualenv
python -m virtualenv testenv

The Virtual Environment is activated by

 source testenv/bin/activate

or

CALL testenv\Scripts\activate.bat

Building PySide2

The script setup.py is used to build and install PySide2 package. It takes a mode argument (build or install) and several options.

Required options:

  • --qmake=<binary> Path to qmake of the Qt library to be used
  • --cmake=<binary> Path to cmake

Further options of interest:

  • ---ignore-git: Prevents setup.py from cloning and checking out the submodules.
  • --build-tests: Creates a directory containing the tests along with some helper packages
  • --debug: Build in Debug mode
  • --openssl: Path to OpenSSL

A typical invokation looks like:

setup.py install ---ignore-git --build-tests --qmake=../bin/qmake --cmake=/usr/bin/cmake