It's based on my fork of Gerard Marull-Paretas' PySide2 work:
- https://github.com/JackLilhammers/pyside2-boilerplate
- https://github.com/gmarull/pyside2-boilerplate
- Dependency management using
pip
- Use the standard
setup.py
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
First of all create a new virtual environment:
python3 -m venv .venv
Then activate it:
Linux:
source .venv/bin/activate
Windows:
.\.venv\Scripts\activate.ps1
Then install the application in development mode:
pip install -e .
Finally install development dependencies:
pip install -r requirements-dev.txt
Autogenerated files such as translation binaries or compiled forms are required but not pushed to the repository, so the first time you will need to generate them as described in the coming section. Once done, you can run the application like this:
python -m app
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 can be built like this:
python setup.py build_res
Note that this command is automatically run before running sdist
and bdist_app
commands.
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:
python setup.py bdist_app
Sphinx is used for documentation purposes. You can tweak its configuration in docs/conf.py
and the documentation can be built like this:
python setup.py build_docs
Flake8 is a great tool to check for style issues, unused imports and similar stuff. You can tweak .flake8
to ignore certain types of errors, increase the maximum line length, etc. You can run it like this:
flake8 app
If PowerShell throws an UnauthorizedAccess error, verify that the execution policy is not Restricted:
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser