Skip to content

Qt for Python Application Boilerplate: Resources, forms, multilanguage, compilation, docs, linting...

License

Notifications You must be signed in to change notification settings

adehad/pyside6-boilerplate

 
 

Repository files navigation

Qt for Python Application Boilerplate

This repository contains a boilerplate for Qt for Python (PySide6) based applications.
It's based on my fork of Jack Lilhammers' PySide6 work, with the modern set of best practice tools:

Qt for Python Application Boilerplate

Features

  • Dependency management using pip, using pdm as our build backend for auto dependency locking.
  • Use the standard ~~``setup.py``~~ pyproject.toml with pdm to build resources, docs, etc.
  • Manage resources and UI forms using a Qt Creator project
  • Generate a compiled application for Windows, Linux and macOS using PyInstaller
  • Multilanguage support
  • Document using Sphinx
  • ~~Flake8 linting~~ adehad replaced with pre-commit, ruff, mypy

Getting started

First of all create a new virtual environment:

pdm install

Autogenerated files such as translation binaries or compiled forms are required but not pushed to the repository, they are generated on install. Once done, you can run the application like this:

python -m app

Resources and translations

In order to ease the development process, the Qt Creator project app.pro is provided. You can open it to edit the UI files or to manage resources. Translations can be edited using Qt Linguist, that's part of the Qt SDK. In order to build the translations, lrelease-pro and lupdate-pro must be in PATH or their full path must be set in the LRELEASE_QT6_BIN and LUPDATE_QT6_BIN environment variables. UI files, translations and resources are:

pdm run post_install

Note that this command is automatically run when installing via pdm install

Compiled application

You can generate a compiled application so that end-users do not need to install anything. You can tweak some settings on the app.spec file. It can be generated like this:

pdm run exe

And found in the dist/app folder.

Documentation

Sphinx is used for documentation purposes. You can tweak its configuration in docs/conf.py and the documentation can be built like this:

pdm run docs

Linting

You can run it like this:

pre-commit run --all-files

About

Qt for Python Application Boilerplate: Resources, forms, multilanguage, compilation, docs, linting...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.6%
  • Dockerfile 5.5%
  • QMake 4.7%
  • Shell 4.2%