Skip to content

Erriez/pyside6-nuitka-deployment

Repository files navigation

PySide6 application build and release Licence MIT Pyside6 Open issue

Pyside6 Deployment Example

This is a Pyside6 example project using Nuitka build for Windows and linux with Github Actions. Other operating systems are not supported by the developer of this repository.

Pyside6 app screenshot

Qt recommends Nuitka or Pyinstaller to create Pyside6 executables for deployment. Nuitka creates smaller executables compared with Pyinstaller, but Pyinstaller build is faster.

Download executables created by Github Action

Download executables for Windows or Linux from:

Linux installer:

No sudo rights are required as the executable is installed in the user's home directory ~/.local/bin/erriez/:

# Add executable flag after download with command:
$ chmod +x erriez-pyside6-app-linux-setup.run
 
# Run setup:
$ ./erriez-pyside6-app-linux-setup.run

Press `q` to quit license.
Please type y to accept, n otherwise: y
...

Start the application via desktop menu | Accessories.

Linux standalone application:

The Linux standalone executable can be started directly without sudo or installation:

# Add executable flag after download with command:
$ chmod +x erriez-pyside6-app
 
# Start executable:
$ ./erriez-pyside6-app

Windows::

  • Run erriez-pyside6-app.exe as portable standalone application, or:
  • Run erriez-pyside6-app-setup.exe to install on Windows (default: C:\Program Files\Erriez\) which creates a shortcut in the start menu and desktop:

Build executable manually

# Clone project
$ git clone https://github.com/Erriez/pyside6-nuitka-deployment.git
$ cd pyside6-nuitka-deployment

# Install Linux system dependencies
$ sudo apt install python3-virtualenv ccache clang patchelf

# Create virtual environment
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ pip install nuitka

Build executable on Ubuntu/Mint 22.04/22.10 Desktop manually

Create single executable for Linux:

# Build executable for Linux
$ python3 -m nuitka \
    --output-dir=dist \
    --output-file=pyside6-app-linux \
    --onefile \
    --enable-plugin=pyside6 \
    --include-data-dir=images=images \
    main.py

# Start created executable
$ ./pyside6-app-linux

Build executable on Windows 10/11 Desktop manually

# Fix virtualenv issues
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

# Build executable for Windows
> python -m nuitka `
    --output-dir=dist `
    --output-file=pyside6-app.exe `
    --onefile `
    --assume-yes-for-downloads `
    --enable-plugin=pyside6 `
    --include-data-dir=images=images `
    --disable-console `
    --windows-icon-from-ico=images/app.ico `
    --company-name="Erriez Open Source Software" `
    --product-name="PySide6 App" `
    --file-version="1.0.0.0" `
    --product-version="`1.0.0.0" `
    --file-description="PySide6 Example App" `
    --copyright="MIT (c) 2023 by Erriez" `
    main.py

# Start created executable
> dist\pyside6-app.exe

Build Windows executable with pyinstaller manually

# https://pypi.org/project/pyinstaller-versionfile/
> pip install pyinstaller pyinstaller-versionfile
> create-version-file --outfile version_info.txt version_info.yaml
> pyinstaller `
    --distpath dist `
    --name pyside6-app-pyinstaller.exe `
    --noconfirm `
    --onefile `
    --noconsole `
    --ico images\app.ico `
    --add-data "images;images" `
    --version-file version_info.txt `
    main.py

Build Windows MSI manually

  • Download NSIS v3.
  • Download NSIS Quick Setup Script Generator.
  • Start NSIS Quick Setup Script Generator.exe and fill-in the wizard.
  • Copy generated file from Output\App\*.nsi to install.nsi and change to relative path / customize file.

Version numbering

Manual version updates are required in:

  • CHANGELOG.md
  • Git tag in format vx.x.x

False positives virusscanners

Windows Defender and virusscanners such as https://www.virustotal.com/ shows false positives when building executable with Pyinstaller or Nuitka. This is a known issue.

MIT License

This project is published under MIT license with an additional end user agreement (next section).

End User Agreement 🇺🇦

End users shall accept the End User Agreement holding export restrictions to Russia to stop the WAR before using this project.