diff options
author | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2023-04-04 17:19:23 +0200 |
---|---|---|
committer | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2023-04-05 09:26:43 +0200 |
commit | 900c050c66119454585ec83cf31149f6d64dd3ea (patch) | |
tree | c9db45471d33aaf9ca6ad7de191d73eed2cbec24 /sources/pyside6/doc/deployment | |
parent | d35b650fe4369952a44c3891fedb6d8ee1417df5 (diff) |
doc: fix issues with pyside rst files
Fixing extra indentation, syntax issues, and formatting.
Adapting too some snippet line highlights, and many other
details.
Pick-to: 6.5
Change-Id: Ife4eb5cec03577b2902d409b4007ae6d12141747
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/doc/deployment')
8 files changed, 197 insertions, 194 deletions
diff --git a/sources/pyside6/doc/deployment/deployment-briefcase.rst b/sources/pyside6/doc/deployment/deployment-briefcase.rst index 95aee1432..e85e618a7 100644 --- a/sources/pyside6/doc/deployment/deployment-briefcase.rst +++ b/sources/pyside6/doc/deployment/deployment-briefcase.rst @@ -1,13 +1,16 @@ |project| & Briefcase ####################### -`Briefcase <https://briefcase.readthedocs.io>`_ is a packaging tool that lets you create a standalone package for a Python application. It supports the following installer formats: +`Briefcase <https://briefcase.readthedocs.io>`_ is a packaging tool that lets +you create a standalone package for a Python application. It supports the +following installer formats: - * .app application bundle for macOS - * MSI installer for Windows - * AppImage for Linux +* ``.app`` application bundle for macOS +* MSI installer for Windows +* AppImage for Linux -For more details, see the `official documentation <https://briefcase.readthedocs.io/en/latest/index.html>`_. +For more details, see the `official documentation +<https://briefcase.readthedocs.io/en/latest/index.html>`_. Status of Qt 6 Support ====================== @@ -17,15 +20,15 @@ As of March 2021, Qt 6 is not supported yet. Preparation =========== -Install `Briefcase` using the following **pip** command:: +Install ``Briefcase`` using the following **pip** command:: pip install briefcase You also need : docker on linux, `WixToolset`_ on windows, -If you're using a virtual environment, remember to activate it before installing `Briefcase`. +If you're using a virtual environment, remember to activate it before installing ``Briefcase``. -After installation, the `briefcase` binary is located in your virtual environment's `bin/` +After installation, the ``briefcase`` binary is located in your virtual environment's ``bin/`` directory, or where your Python executable is located. You can either create a brand new project using the briefcase assistant or setup your own. @@ -39,8 +42,8 @@ Run the following command and answer the questions to get started:: briefcase new -Ensure that `PySide6` is chosen as the `GUI toolkit choice`. -Your PySide6 application is now configured. You can jump to `Build the package`_. +Ensure that |pymodname| is chosen as the **GUI toolkit choice**. +Your |pymodname| application is now configured. You can jump to `Build the package`_. Set up your project @@ -49,7 +52,7 @@ Set up your project Create a pyproject.toml ----------------------- -At the root level of your project, create a `pyproject.toml` file:: +At the root level of your project, create a ``pyproject.toml`` file:: [tool.briefcase] project_name = "MyPySideApp" @@ -85,7 +88,7 @@ At the root level of your project, create a `pyproject.toml` file:: Write some code ----------------- +--------------- Let's say your project tree is like this:: @@ -103,7 +106,7 @@ Let's say your project tree is like this:: app.py -Content of `__main__.py`:: +Content of ``__main__.py``:: import sys from PySide6.QtWidgets import QApplication @@ -119,7 +122,7 @@ Content of `__main__.py`:: sys.exit(app.exec()) -Content of `app.py`:: +Content of ``app.py``:: import random from PySide6.QtWidgets import (QLabel, QPushButton, @@ -151,10 +154,10 @@ Content of `app.py`:: Build the package -================== +================= Initialize the package ------------------------- +---------------------- Just run:: @@ -162,7 +165,8 @@ Just run:: Run the following command to initialize the building the packages for Windows, Linux, and macOS. It creates a subdirectory each for the different platforms. -This step takes longer as it adds the packages listed in `requires` sections in the `pyproject.toml` file. +This step takes longer as it adds the packages listed in ``requires`` sections in the +``pyproject.toml`` file. Build the application --------------------- @@ -185,20 +189,23 @@ Run the application briefcase run -.. note:: You can run your project in `dev` mode (your source code not packaged) with `briefcase dev` +.. note:: You can run your project in ``dev`` mode (your source code not packaged) with + ``briefcase dev`` Build the installer (only Windows and macOS) ---------------------------------------------- +-------------------------------------------- macOS:: briefcase package --no-sign -It's possible to sign, see the `documentation <https://briefcase.readthedocs.io/en/latest/how-to/code-signing/index.html>`_. You get `macOS/A Cool App-0.0.1.dmg` +It's possible to sign, see the +`documentation <https://briefcase.readthedocs.io/en/latest/how-to/code-signing/index.html>`_. +You get ``macOS/A Cool App-0.0.1.dmg`` Windows:: briefcase package -You get `windows\A_Cool_App-0.0.1.msi` +You get ``windows\A_Cool_App-0.0.1.msi`` diff --git a/sources/pyside6/doc/deployment/deployment-cxfreeze.rst b/sources/pyside6/doc/deployment/deployment-cxfreeze.rst index 612ca5a32..46cbb142e 100644 --- a/sources/pyside6/doc/deployment/deployment-cxfreeze.rst +++ b/sources/pyside6/doc/deployment/deployment-cxfreeze.rst @@ -15,31 +15,31 @@ if you find any, or contributing to `their development <https://github.com/marce Preparation =========== -Installing `cx_Freeze` can be done using **pip**:: +Installing ``cx_Freeze`` can be done using **pip**:: pip install cx_freeze If you are using a virtual environment, remember to activate it before -installing `cx_Freeze` into it. +installing ``cx_Freeze`` into it. -After the installation, you will have the `cxfreeze` binary to deploy +After the installation, you will have the ``cxfreeze`` binary to deploy your application. Freezing an application ======================= -There are three options to work with `cx_Freeze`: +There are three options to work with ``cx_Freeze``: - 1. Using the `cxfreeze` script. - 2. Creating `setup.py` script to build the project. - 3. Using the module classes directly (for advanced purposes). +1. Using the ``cxfreeze`` script. +2. Creating ``setup.py`` script to build the project. +3. Using the module classes directly (for advanced purposes). The following sections cover the first two use cases. Creating an example ------------------- -Now, consider the following simple script, named `hello.py`:: +Now, consider the following simple script, named ``hello.py``:: import sys import random @@ -80,28 +80,28 @@ Now, consider the following simple script, named `hello.py`:: sys.exit(app.exec()) -Using `cxfreeze` executable ---------------------------- +Using ``cxfreeze`` executable +----------------------------- Now that we have an application, try freezing it with the following command:: cxfreeze hello.py -This command creates a `dist/` directory containing the executable. -and a `lib/` directory containing all the shared libraries. +This command creates a ``dist/`` directory containing the executable. +and a ``lib/`` directory containing all the shared libraries. -To launch the application, go to the `dist/` directory and execute +To launch the application, go to the ``dist/`` directory and execute the file:: cd dist/ ./main -Using a setuptools script -------------------------- +Using a ``setuptools`` script +----------------------------- -For this process, you need an additional script called `setup.py`:: +For this process, you need an additional script called ``setup.py``:: import sys from cx_Freeze import setup, Executable @@ -115,15 +115,15 @@ Now, build the project using it:: python setup.py build -This step creates a `build/` directory with the following structure:: +This step creates a ``build/`` directory with the following structure:: build └── exe.linux-x86_64-3.7 └── lib └── main -The first directory inside `build/` depends on the platform -you are using, in this case a `x86_64` Linux using Python 3.7. +The first directory inside ``build/`` depends on the platform +you are using, in this case a ``x86_64`` Linux using Python 3.7. The structure is the same as previously described, and you can simply enter the directory and execute the file:: diff --git a/sources/pyside6/doc/deployment/deployment-fbs.rst b/sources/pyside6/doc/deployment/deployment-fbs.rst index 1098ccd4e..459a225bf 100644 --- a/sources/pyside6/doc/deployment/deployment-fbs.rst +++ b/sources/pyside6/doc/deployment/deployment-fbs.rst @@ -2,7 +2,7 @@ #################### `fbs`_ provides a powerful environment for packaging, creating installers, and signing your -application. It also lets you manage updates to your application. Since `fbs` is based on +application. It also lets you manage updates to your application. Since `fbs`_ is based on PyInstaller, it supports Linux, macOS, and Windows. For more details, see the `fbs tutorial`_ and the `fbs manual`_. @@ -32,12 +32,12 @@ command:: This command prompts you to answer a few questions to configure the details of your project, like: - * Application name - * Author name - * Qt bindings (PySide6 or PyQt5) - * Bundle indentified (for macOS) +* Application name +* Author name +* Qt bindings (PySide6) +* Bundle indentified (for macOS) -Afterwards, you have a `src/` directory that contains the following structure:: +Afterwards, you have a ``src/`` directory that contains the following structure:: └── src ├── build @@ -49,10 +49,10 @@ Afterwards, you have a `src/` directory that contains the following structure:: │ └── mac └── python -Inside the `settings` directory, there are a few JSON files that can be edited to include more +Inside the ``settings`` directory, there are a few JSON files that can be edited to include more information about your project. -The `main` file is in the `python` directory, and its default content is:: +The ``main`` file is in the ``python`` directory, and its default content is:: from fbs_runtime.application_context import ApplicationContext from PySide6.QtWidgets import QMainWindow @@ -67,7 +67,7 @@ The `main` file is in the `python` directory, and its default content is:: exit_code = appctxt.app.exec() # 2. Invoke appctxt.app.exec() sys.exit(exit_code) -This example shows an empty `QMainWindow`. You can run it using the following command:: +This example shows an empty ``QMainWindow``. You can run it using the following command:: fbs run @@ -87,11 +87,11 @@ example:: Now, you can try to run the application. The result is the same window as the one you saw with the -`fbs run` command:: +``fbs run`` command:: cd target/MyApp/ ./MyApp .. note:: This is the case for Linux. For other platforms like macOS, you need to enter the - directory: `target/MyApp.app/Contents/macOS`. For Windows, you need to find the `MyApp.exe` + directory: ``target/MyApp.app/Contents/macOS``. For Windows, you need to find the ``MyApp.exe`` executable. diff --git a/sources/pyside6/doc/deployment/deployment-nuitka.rst b/sources/pyside6/doc/deployment/deployment-nuitka.rst index 9be982a4c..8b0afa56c 100644 --- a/sources/pyside6/doc/deployment/deployment-nuitka.rst +++ b/sources/pyside6/doc/deployment/deployment-nuitka.rst @@ -11,11 +11,11 @@ For more details, see the `official documentation <https://nuitka.net/pages/over Preparation =========== -Install `Nuitka` via **pip** with the following command:: +Install ``Nuitka`` via **pip** with the following command:: - pip3 install nuitka + pip install nuitka -After installation, the `nuitka3` binary is located in your virtual environment's `bin/` +After installation, the ``nuitka3`` binary is located in your virtual environment's ``bin/`` directory, or where your Python executable is located. Alternatively, you can also run:: @@ -26,7 +26,7 @@ to achieve the same effect. Freeze an application ===================== -`Nuitka` has many options that you can use. To list them all, run `nuitka3 -h`. +``Nuitka`` has many options that you can use. To list them all, run ``nuitka3 -h``. To simply compile a project, you can run:: @@ -34,17 +34,17 @@ To simply compile a project, you can run:: There are two main features: - * the option to place it in a directory containing the libraries - (`--standalone`) - * the option to package the whole project (including shared libraries) into one executable file - (`--onefile`) +* the option to place it in a directory containing the libraries + (``--standalone``) +* the option to package the whole project (including shared libraries) into one executable file + (``--onefile``) -If you use these options, you need to specify `--plugin-enable=pyside6`. +If you use these options, you need to specify ``--plugin-enable=pyside6``. Run an example -------------- -Now, consider the following script, named `hello.py`:: +Now, consider the following script, named ``hello.py``:: import sys import random @@ -84,13 +84,13 @@ Now, consider the following script, named `hello.py`:: sys.exit(app.exec()) -You don't have to copy this script. You find it as `examples/installer_test/hello.py`. +You don't have to copy this script. You find it as ``examples/installer_test/hello.py``. The command line to proceed looks like this:: nuitka3 examples/installer_test/hello.py -This process creates an executable `hello.bin` and a directory hello.build that you +This process creates an executable ``hello.bin`` and a directory hello.build that you don't need. You can execute the binary directly. In order to create a bundle which can be copied onto a machine without any pre-existing @@ -98,23 +98,23 @@ installation, run:: nuitka3 --standalone --plugin-enable=pyside6 examples/installer_test/hello.py -This creates an application `hello.dist/hello` that contains everything needed to run. +This creates an application ``hello.dist/hello`` that contains everything needed to run. -To run the application, go to `hello.dist/` and run the program:: +To run the application, go to ``hello.dist/`` and run the program:: cd hello.dist ./hello -Use the `--onefile` option if you prefer to have everything bundled into one executable, without +Use the ``--onefile`` option if you prefer to have everything bundled into one executable, without the shared libraries next to it. First you need to install:: - pip3 install zstandard + pip install zstandard -for data compression. Then you can run +for data compression. Then you can run:: nuitka3 --onefile --plugin-enable=pyside6 examples/installer_test/hello.py -This process takes a bit longer, but in the end you have one executable `hello.bin`:: +This process takes a bit longer, but in the end you have one executable ``hello.bin``:: ./hello.bin @@ -127,6 +127,6 @@ Nuitka issue on macOS --------------------- Nuitka currently has a problem with the macOS bundle files on current macOS versions. -That has the effect that `--standalone` and `--onefile` create a crashing application. +That has the effect that ``--standalone`` and ``--onefile`` create a crashing application. Older versions which don't have the recent macOS API changes from 2020 will work. We are currently trying to fix that problem. diff --git a/sources/pyside6/doc/deployment/deployment-py2exe.rst b/sources/pyside6/doc/deployment/deployment-py2exe.rst index 24d260d71..6ca09a826 100644 --- a/sources/pyside6/doc/deployment/deployment-py2exe.rst +++ b/sources/pyside6/doc/deployment/deployment-py2exe.rst @@ -1,16 +1,16 @@ |project| & py2exe ################## -Deploying an application using py2exe requires writing a small `setup.py` file. +Deploying an application using py2exe requires writing a small ``setup.py`` file. It is explained in the `Tutorial <http://www.py2exe.org/index.cgi/Tutorial>`_. py2exe is not generally aware of Qt. It merely copies the dependent libraries -of the application to the `dist` directory, so, the plugins, QML imports +of the application to the ``dist`` directory, so, the plugins, QML imports and translations of Qt are missing. The latter need to be copied manually after running py2exe. -This can be achieved by running the `windeployqt` tool -from the Qt SDK on the Qt libraries present in the `dist` directory, -for example: +This can be achieved by running the ``windeployqt`` tool +from the Qt SDK on the Qt libraries present in the ``dist`` directory, +for example:: windeployqt dist\\Qt6Widgets.dll diff --git a/sources/pyside6/doc/deployment/deployment-pyinstaller.rst b/sources/pyside6/doc/deployment/deployment-pyinstaller.rst index 8d78ddba0..feb257162 100644 --- a/sources/pyside6/doc/deployment/deployment-pyinstaller.rst +++ b/sources/pyside6/doc/deployment/deployment-pyinstaller.rst @@ -11,15 +11,15 @@ Status of Qt 6 Support ====================== As of March 2021, Qt 6 is not supported yet. PyInstaller is unable to properly -deploy Qt; the Qt plugins are not copied. With that, using `--onefile` is not +deploy Qt; the Qt plugins are not copied. With that, using ``--onefile`` is not possible. -It is possible to use PyInstaller for the non `--onefile` case though by +It is possible to use PyInstaller for the non ``--onefile`` case though by manually copying the Qt plugins, QML imports and translations into the dist directory after running PyInstaller. -On Windows, this can be achieved by running the `windeployqt` tool -from the Qt SDK on the Qt libraries present in the `dist` directory, for +On Windows, this can be achieved by running the ``windeployqt`` tool +from the Qt SDK on the Qt libraries present in the ``dist`` directory, for example: windeployqt dist\\app\\Qt6Widgets.dll @@ -28,15 +28,15 @@ example: Preparation =========== -Install the `PyInstaller` via **pip** with the following command:: +Install the ``PyInstaller`` via **pip** with the following command:: pip install pyinstaller -If you're using a virtual environment, remember to activate it before installing `PyInstaller`. +If you're using a virtual environment, remember to activate it before installing ``PyInstaller``. -After installation, the `pyinstaller` binary is located in your virtual environment's `bin/` -directory, or where your Python executable is located. If that directory isn't in your `PATH`, -include the whole path when you run `pyinstaller`. +After installation, the ``pyinstaller`` binary is located in your virtual environment's ``bin/`` +directory, or where your Python executable is located. If that directory isn't in your ``PATH``, +include the whole path when you run ``pyinstaller``. .. warning:: If you already have a PySide6 or Shiboken6 version installed in your system path, PyInstaller uses them instead of your virtual environment version. @@ -44,24 +44,24 @@ include the whole path when you run `pyinstaller`. Freeze an application ======================= -`PyInstaller` has many options that you can use. To list them all, run `pyinstaller -h`. +``PyInstaller`` has many options that you can use. To list them all, run ``pyinstaller -h``. There are two main features: * the option to package the whole project (including shared libraries) into one executable file - (`--onefile`) + (``--onefile``) * the option to place it in a directory containing the libraries -Additionally, on Windows when the command is running, you can open a console with the `-c` option -(or `--console` or `--nowindowed` equivalent). +Additionally, on Windows when the command is running, you can open a console with the ``-c`` option +(or ``--console`` or ``--nowindowed`` equivalent). -Otherwise, you can specify to not open such a console window on macOS and Windows with the `-w` -option (or `--windowed` or `--noconsole` equivalent). +Otherwise, you can specify to not open such a console window on macOS and Windows with the ``-w`` +option (or ``--windowed`` or ``--noconsole`` equivalent). Create an example ----------------- -Now, consider the following script, named `hello.py`:: +Now, consider the following script, named ``hello.py``:: import sys import random @@ -102,28 +102,29 @@ Now, consider the following script, named `hello.py`:: sys.exit(app.exec()) -Since it has a UI, you use the `--windowed` option. +Since it has a UI, you use the ``--windowed`` option. The command line to proceed looks like this:: pyinstaller --name="MyApplication" --windowed hello.py -This process creates two directories: `dist/` and `build/`. The application executable and the -required shared libraries are placed in `dist/MyApplication`. +This process creates two directories: ``dist/`` and ``build/``. The application executable and the +required shared libraries are placed in ``dist/MyApplication``. -To run the application, go to `dist/MyApplication` and run the program:: +To run the application, go to ``dist/MyApplication`` and run the program:: cd dist/MyApplication/ ./MyApplication -.. note:: The directory inside `dist/` and the executable have the same name. +.. note:: The directory inside ``dist/`` and the executable have the same name. -Use the `--onefile` option if you prefer to have everything bundled into one executable, without +Use the ``--onefile`` option if you prefer to have everything bundled into one executable, without the shared libraries next to it:: pyinstaller --name="MyApplication" --windowed --onefile hello.py -This process takes a bit longer, but in the end you have one executable in the `dist/` directory:: +This process takes a bit longer, but in the end you have one executable in the +``dist/`` directory:: cd dist/ ./MyApplication @@ -136,26 +137,26 @@ Some Caveats PyInstaller Issue ----------------- -As mentioned before, if available, `PyInstaller` picks a system installation of PySide6 or -Shiboken6 instead of your `virtualenv` version without notice. This is negligible if those +As mentioned before, if available, ``PyInstaller`` picks a system installation of |pymodname| or +Shiboken6 instead of your ``virtualenv`` version without notice. This is negligible if those two versions are the same. If you're working with different versions, this can result in frustrating debugging sessions -when you think you are testing the latest version, but `PyInstaller` is working with an older +when you think you are testing the latest version, but ``PyInstaller`` is working with an older version. Safety Instructions ------------------- -- When using `PyInstaller` with `virtualenv`, make sure that there is no system +- When using ``PyInstaller`` with ``virtualenv``, make sure that there is no system installation of PySide6 or shiboken6. -- Before compiling, use `pip -uninstall pyside6 shiboken6 -y` multiple times, until - none of the programs are found anymore. +- Before compiling, use ``pip -uninstall pyside6 pyside6_essentials pyside6_addons shiboken6 -y`` + multiple times, until none of the programs are found anymore. - Pip is usually a good tool. But to be 100 % sure, you should directly remove - the PySide6 and shiboken6 folders from site-packages. + the PySide6 and shiboken6 folders from ``site-packages``. - Be sure to use the right version of pip. The safest way to really run the right pip, is to use the Python that you mean: Instead of the pip command, better use:: diff --git a/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst b/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst index 1fde3104f..417a1f65f 100644 --- a/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst +++ b/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst @@ -3,48 +3,51 @@ pyside6-deploy: the deployment tool for Qt for Python ##################################################### -`pyside6-deploy` is an easy to use tool for deploying PySide6 applications to different platforms. -It is a wrapper around `Nuitka <https://nuitka.net/>`_, a Python compiler that compiles your Python -code to C code, and links with libpython to produce the final executable. +``pyside6-deploy`` is an easy to use tool for deploying PySide6 applications to different +platforms. It is a wrapper around `Nuitka <https://nuitka.net/>`_, a Python compiler that +compiles your Python code to C code, and links with libpython to produce the final executable. -The final executable produced has a `.exe` suffix on Windows. For Linux and macOS, they have a `.bin` -suffix. +The final executable produced has a ``.exe`` suffix on Windows. For Linux and macOS, they have a +``.bin`` suffix. How to use it? ============== -There are 2 different ways with which you can deploy your PySide6 application using `pyside6-deploy` +There are 2 different ways with which you can deploy your PySide6 application using +``pyside6-deploy``: Approach 1: Using the main python entry point file -------------------------------------------------- -In this approach, you point `pyside6-deploy` to the file containing the main Python entry point file -of the project i.e. the file containing `if __name__ == "__main__":`. The command looks like this:: +In this approach, you point ``pyside6-deploy`` to the file containing the main Python entry point +file of the project i.e. the file containing ``if __name__ == "__main__":``. +The command looks like this:: pyside6-deploy /path/to/main_file.py -On running the command, `pyside6-deploy` installs all the dependencies required for deployment +On running the command, ``pyside6-deploy`` installs all the dependencies required for deployment into the Python environment. -If your main Python entry point file is named `main.py`, then you don't have to point it to the -filename. You can run `pyside6-deploy` without any options, and it will work. +If your main Python entry point file is named ``main.py``, then you don't have to point it to the +filename. You can run ``pyside6-deploy`` without any options, and it will work. -.. note:: If your project contains a `pysidedeploy.spec` file, which is generated on the first run - of `pyside6-deploy` on the project directory, then for any subsequent runs of `pyside6-deploy` - you can run `pyside6-deploy` without specifying the main Python entry point file. It would take - the path to the main file from the `pysidedeploy.spec` file. To know more about what deployment - parameters are controlled by `pysidedeploy.spec` file, read `pysidedeploy`_. +.. note:: If your project contains a ``pysidedeploy.spec`` file, which is generated on the first + run of ``pyside6-deploy`` on the project directory, then for any subsequent runs of + ``pyside6-deploy`` you can run ``pyside6-deploy`` without specifying the main Python entry + point file. It would take the path to the main file from the ``pysidedeploy.spec`` file. + To know more about what deployment parameters are controlled by ``pysidedeploy.spec`` file, + read `pysidedeploy`_. .. _approach_two: Approach 2: Using pysidedeploy.spec config file ------------------------------------------------ -When you run `pyside6-deploy` for the first time, it creates a file called `pysidedeploy.spec` in -the project directory. This file controls various :ref:`parameters <pysidedeploy>` that influence -the deployment process. Any subsequent runs of `pyside6-deploy` on the project directory, would not -require additional parameters like the main Python entry point file. You can also point -`pyside6-deploy` to the path of the `pysidedeploy.spec` file (in case it is not in the same +When you run ``pyside6-deploy`` for the first time, it creates a file called ``pysidedeploy.spec`` +in the project directory. This file controls various :ref:`parameters <pysidedeploy>` that influence +the deployment process. Any subsequent runs of ``pyside6-deploy`` on the project directory, would +not require additional parameters like the main Python entry point file. You can also point +``pyside6-deploy`` to the path of the ``pysidedeploy.spec`` file (in case it is not in the same directory), to take the parameters from that file. This can be done with the following command:: pyside6-deploy -c /path/to/pysidedeploy.spec @@ -69,88 +72,80 @@ two folds: The various parameters controlled by this file are: -* `app` - - * `title`: The name of the application - - * `project_dir`: Project directory. The general assumption made is that the project directory - is the parent directory of the main Python entry point file - - * `input_file`: Path to the main Python entry point file - - * `project_file`: If it exists, this points to the path to the `Qt Creator Python Project File - .pyproject <https://doc.qt.io/qtforpython/tutorials/pretutorial/typesoffiles.html - #qt-creator-python-project-file-pyproject>`_ file. Such a file makes sure that the deployment - process never considers unnecessary files when bundling the executable. - -* `python` - - * `python_path`: Path to the Python executable. It is recommended to run the deployment process - inside a virtual environment as certain python packages will be installed onto the Python - environment. - - * `packages`: The Python packages installed into the Python environment for deployment to work. - By default, the Python packages `nuitka <https://pypi.org/project/Nuitka/>`__, - `ordered_set <https://pypi.org/project/ordered-set/>`_ and `zstandard - <https://pypi.org/project/zstandard/>`_ are installed. If the deployment platform is - Linux-based, then `patchelf <https://pypi.org/project/patchelf/>`_ is also installed - -* `qt` - - * `qml_files`: Comma-separated paths to all the QML files bundled with the executable - - * `excluded_qml_plugins`: The problem with using Nuitka for QML deployment is that all the QML - plugins are also bundled with the executable. When the plugins are bundled, the binaries of - the plugin's Qt module are also packaged. For example, size heavy module like QtWebEngine - also gets added to your executable, even when you do not use it in your code. The - `excluded_qml_plugins` parameter helps you to explicitly specify which all QML plugins are - excluded. `pyside6-deploy` automatically checks the QML files against the various QML plugins - and excludes the following Qt modules if they don't exist:: - - QtQuick, QtQuick3D, QtCharts, QtWebEngine, QtTest, QtSensors - - The reason why only the presence of the above 6 Qt modules is searched for is because they - have the most size heavy binaries among all the Qt modules. With this, you can drastically - reduce the size of your executables. - -* `nuitka` - - * `extra_args`: Any extra Nuitka arguments specified. It is specified as space-separated - command line arguments i.e. just like how you would specify it when you use Nuitka through - the command line. By default, it contains the following arguments:: - - --quiet --noinclude-qt-translations=True +**app** + * ``title``: The name of the application + * ``project_dir``: Project directory. The general assumption made is that the project directory + is the parent directory of the main Python entry point file + * ``input_file``: Path to the main Python entry point file + * ``project_file``: If it exists, this points to the path to the `Qt Creator Python Project File + .pyproject <https://doc.qt.io/qtforpython/tutorials/pretutorial/typesoffiles.html + #qt-creator-python-project-file-pyproject>`_ file. Such a file makes sure that the deployment + process never considers unnecessary files when bundling the executable. + +**python** + * ``python_path``: Path to the Python executable. It is recommended to run the deployment + process inside a virtual environment as certain python packages will be installed onto the + Python environment. + * ``packages``: The Python packages installed into the Python environment for deployment to + work. By default, the Python packages `nuitka <https://pypi.org/project/Nuitka/>`__, + `ordered_set <https://pypi.org/project/ordered-set/>`_ and `zstandard + <https://pypi.org/project/zstandard/>`_ are installed. If the deployment platform is + Linux-based, then `patchelf <https://pypi.org/project/patchelf/>`_ is also installed + +**qt** + * ``qml_files``: Comma-separated paths to all the QML files bundled with the executable + * ``excluded_qml_plugins``: The problem with using Nuitka for QML deployment is that all the QML + plugins are also bundled with the executable. When the plugins are bundled, the binaries of + the plugin's Qt module are also packaged. For example, size heavy module like QtWebEngine + also gets added to your executable, even when you do not use it in your code. The + ``excluded_qml_plugins`` parameter helps you to explicitly specify which all QML plugins are + excluded. ``pyside6-deploy`` automatically checks the QML files against the various QML + plugins and excludes the following Qt modules if they don't exist:: + + QtQuick, QtQuick3D, QtCharts, QtWebEngine, QtTest, QtSensors + + The reason why only the presence of the above 6 Qt modules is searched for is because they + have the most size heavy binaries among all the Qt modules. With this, you can drastically + reduce the size of your executables. + +**nuitka** + * ``extra_args``: Any extra Nuitka arguments specified. It is specified as space-separated + command line arguments i.e. just like how you would specify it when you use Nuitka through + the command line. By default, it contains the following arguments:: + + --quiet --noinclude-qt-translations=True Command Line Options ==================== The most important command line options are the path to the main Python entry point file and the -pysidedeploy.spec file. If neither of these files exists or their command line options are given, -then `pyside6-deploy` assumes that your current working directory does not contain a PySide6 project. +``pysidedeploy.spec`` file. If neither of these files exists or their command line options are +given, then ``pyside6-deploy`` assumes that your current working directory does not contain a +PySide6 project. -Here are all the command line options of `pyside6-deploy`: +Here are all the command line options of ``pyside6-deploy``: * **main entry point file**: This option does not have a name or a flag and is not restricted by it. - This enables `pyside6-deploy` to be used like:: + This enables ``pyside6-deploy`` to be used like:: pyside6-deploy /path/to/main_file.py -* **-c/--config-file**: This option is used to specify the path to `pysidedeploy.spec` explicitly +* **-c/--config-file**: This option is used to specify the path to ``pysidedeploy.spec`` explicitly -* **--init**: Used to only create the `pysidedeploy.spec` file +* **--init**: Used to only create the ``pysidedeploy.spec`` file Usage:: pyside6-deploy /path/to/main --init -* **-v/--verbose**: Runs `pyside6-deploy` in verbose mode +* **-v/--verbose**: Runs ``pyside6-deploy`` in verbose mode * **--dry-run**: Displays the final Nuitka command being run * **--keep-deployment-files**: When this option is added, it retains the build folders created by Nuitka during the deployment process. -* **-f/--force**: When this option is used, it forces through all the input prompts. `pyside6-deploy` - prompts the user to create a Python virtual environment, if not already in one. With this option, - the current Python environment is used irrespective of whether the current Python environment is a - virtual environment or not. +* **-f/--force**: When this option is used, it forces through all the input prompts. + ``pyside6-deploy`` prompts the user to create a Python virtual environment, if not already in one. + With this option, the current Python environment is used irrespective of whether the current + Python environment is a virtual environment or not. diff --git a/sources/pyside6/doc/deployment/index.rst b/sources/pyside6/doc/deployment/index.rst index 9785b82d1..6f4c2d44a 100644 --- a/sources/pyside6/doc/deployment/index.rst +++ b/sources/pyside6/doc/deployment/index.rst @@ -20,12 +20,12 @@ that deploys your PySide6 application to all desktop platforms - Windows, Linux, more about how to use the tool see :ref:`pyside6-deploy`. Additionally, you can also use other popular deployment tools shown below: - * `fbs`_ - * `PyInstaller`_ - * `cx_Freeze`_ - * `py2exe`_ - * `py2app`_ - * `briefcase`_ +* `fbs`_ +* `PyInstaller`_ +* `cx_Freeze`_ +* `py2exe`_ +* `py2app`_ +* `briefcase`_ .. _fbs: https://build-system.fman.io/ .. _PyInstaller: https://www.pyinstaller.org/ |