Skip to content

DariuszMak/python-standalone-gui-template

Repository files navigation

Python Standalone GUI template

Dependencies

  • Python 3.10.10
  • Docker

Local configuration:

python -m pip install --upgrade pip
python -m pip install virtualenv
python -m virtualenv venv
  • On Unix or macOS, using the bash shell: source venv/bin/activate
  • On Unix or macOS, using the csh shell: source venv/bin/activate.csh
  • On Unix or macOS, using the fish shell: source venv/bin/activate.fish
  • On Windows using the Command Prompt: venv\Scripts\activate.bat
  • On Windows using PowerShell: venv\Scripts\Activate.ps1

Or just set it in IDE as current environment and then:

pip install -r requirements_dev.txt

Run tests:

pytest

Run tests with coverage report:

pytest . --cov=.

Code autoformat

All in one:

pre-commit run --all-files ; mypy --strict .

Mypy

 mypy .

Isort

isort .

Black

black .

Pre-commit

pre-commit run --all-files

Installing pre-commit hooks

File .pre-commit-config.yaml contains the definition of checks that will be run during the pipeline deployment phase. In order to keep the pipeline happy ;) (and also to make sure we conform to one, centrally defined coding standard) every developer should install the pre-commit-hooks in their local environment to ensure that every commit that is pushed to the remote repository passes the checks.

  • first, install pre-commit library into your python environment:
pip install pre-commit
  • then, install pre-commit hooks defined in the .yaml file:
pre-commit install

This should automatically detect and install all dependencies required by .pre-commit-config.yaml, and also now pre-commit will run automatically on every git commit!

  • unistall pre-commit:
pre-commit uninstall
  • run pre-commit for all files:
pre-commit run --all-files
  • update hooks:
pre-commit install-hooks
  • if you want to ignore errors from changes, use "n" flag:
git commit -n -m "commit message"

Running Docker container service

Build project:

docker-compose build

Run app:

docker-compose run app

Build before running:

docker-compose run --build app

Run tests:

docker-compose run app . /opt/venv/bin/activate ; pip install -r requirements_dev.txt ; pytest . --cov=.

Setup entire project from scratch (Windows)

Make sure, that everything is committed or stashed and (optionally):

git reset --hard HEAD ; git clean -x -d -f

then

.\setup_docker_from_scratch.bat ; .\setup_local_project_from_scratch.bat

In order to replace generated ui files manually (if docker didn't do it before) run:

venv\Scripts\Activate.ps1 ; python src\gui_setup.py

Running executable application via PyInstaller

In order to generate executable application, run:

.\standalone_build.bat

GUI files specification

.qrc - resources file edited in QT Designer

.ui - QT Designer form

ui_*.py - QT Designer generated tools

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published