A Template repository for QtQuick Python.
- Git 2.32 (or more recent)
- Python 3.11.0 (or more recent)
Recommended IDE: Visual Studio Code
If you prefer PyCharm, switch to branch: pycharm
To setup Development Environment, run the following commands:
# git clone this repository
cd QtQuickPythonTemplate
# create venv
python3 -m venv .venv
# activate venv
source .venv/bin/activate
# for Windows Command Prompt, run the following command to activate venv
# .venv\Scripts\activate.bat
# for Windows Powershell, run the following command to activate venv
# .venv\Scripts\Activate.ps1
# for Winows Git Bash, run the following command to activate venv
# source .venv/Scripts/activate
# install packages
pip3 install -e .[dev]
# generate snake_case and true_property pyi for VSCode
pyside6-genpyi all --feature snake_case true_property
# deactivate venv
deactivate
# open current folder using VSCode
code .
After opening the folder, install the following extensions:
- ms-python.python
- ms-python.vscode-pylance
- ms-python.pylint
- ms-python.black-formatter
- seanwu.vscode-qt-for-python
- esbenp.prettier-vscode
- Gruntfuggly.triggertaskonsave
These extensions have been written in .vscode/extensions.json
, you can also click Yes
when VSCode ask you whether to install the recommended extensions, which makes it easier to install all the above extensions.
The next step is to select the interpreter under .venv
folder as the development interpreter. Simply press Ctrl + Shift + P
, then enter Python: Select Interpreter
command.
Finally, press F5
. The application should be launched in debug mode.
- Clone or download this repository
- Rename the root folder and the
src/qt_quick_python_template
- Search
qt_quick_python_template
andQtQuickPythonTemplate
in VSCode and replace all the strings with your own project name - Change the
APP_NAME
andORGANIZATION_NAME
variable insrc/qt_quick_python_template/const/app_const.py
- Run
pip3 install -e .[dev]
to apply the changes above - Change the icon in
resouce/icon.jpg
, change it to a.ico
format icon will be better(for deployment) - If you clone the repository with git, remove the
.git
directory and regenerate it withgit init
The major 3 operate systems: Windows, MacOS, Linux(Ubuntu / Debian), is supported.
To deploy the application, simply press Ctrl + P
in VSCode, then:
- enter
task Deploy(Release PyInstaller)
, if the task is performed successfully, the application will be deployed under:${workspaceFolder}/deployment/dist
- enter
task Deploy(Release Nuitka)
, if the task is performed successfully, the application will be deployed under:${workspaceFolder}/deployment/__main__.dist
See spec files under ${workspaceFolder}/src/qt_quick_python_tools/spec
for more information.
Deployment using Nuitka excludes unused Qt modules, remove the exclusions in
${workspaceFolder}/src/qt_quick_python_tools/spec/nuitka_spec.py
if you want to use them.