aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/deployment/index.rst
blob: 36e677566a1b01b49e9b79019260c3742c872611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.. _deployment-guides:

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) <https://packaging.python.org/>`_.
 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 :ref:`pyside6-deploy`. For Android deployment, see
:ref:`pyside6-android-deploy`. Additionally, you can also use other popular deployment tools shown
below:

* `fbs`_
* `PyInstaller`_
* `cx_Freeze`_
* `py2exe`_
* `py2app`_
* `briefcase`_

.. _fbs: https://build-system.fman.io/
.. _PyInstaller: https://www.pyinstaller.org/
.. _cx_Freeze: https://marcelotduarte.github.io/cx_Freeze/
.. _py2exe: http://www.py2exe.org/
.. _py2app: https://py2app.readthedocs.io/en/latest/
.. _briefcase: https://briefcase.readthedocs.io

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
|project| 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:

.. raw:: html

    <table class="docutils align-default">
      <thead>
        <tr>
          <th class="head">Name</th>
          <th class="head">License</th>
          <th class="head">Qt 6</th>
          <th class="head">Qt 5</th>
          <th class="head">Linux</th>
          <th class="head">macOS</th>
          <th class="head">Windows</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><p>fbs</p></td>
          <td><p>GPL</p></td>
          <td></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
        <tr>
          <td><p>PyInstaller</p></td>
          <td><p>GPL</p></td>
          <td><p style="color: green;">partial</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
        <tr>
          <td><p>cx_Freeze</p></td>
          <td><p>MIT</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
        <tr>
          <td><p>py2exe</p></td>
          <td><p>MIT</p></td>
          <td><p style="color: green;">partial</p></td>
          <td><p style="color: green;">partial</p></td>
          <td><p style="color: red;">no</p></td>
          <td><p style="color: red;">no</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
        <tr>
          <td><p>py2app</p></td>
          <td><p>MIT</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: red;">no</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: red;">no</p></td>
        </tr>
        <tr>
          <td><p>briefcase</p></td>
          <td><p>BSD3</p></td>
          <td><p style="color: green;">partial</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
        <tr>
          <td><p>Nuitka</p></td>
          <td><p>MIT</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
          <td><p style="color: green;">yes</p></td>
        </tr>
      </tbody>
    </table>

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 <https://www.pyupdater.org/>`_, 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:

.. toctree::
    :name: mastertoc
    :maxdepth: 2

    deployment-pyside6-deploy.rst
    deployment-pyside6-android-deploy.rst
    deployment-fbs.rst
    deployment-pyinstaller.rst
    deployment-cxfreeze.rst
    deployment-briefcase.rst
    deployment-py2exe.rst
    deployment-nuitka.rst