Skip to main content

Cookbook and examples for pyqt6-scaffold

Project description

PyQt6 Scaffold Cookbook

A curated collection of practical examples for building applications using PyQt6 Scaffold.

This repository demonstrates how to structure real-world applications using:

  • Database abstraction layer
  • Navigation and window composition
  • Role-based access control (RBAC)
  • Declarative UI patterns
  • Card-based UI architecture
  • CRUD-driven interfaces

It is designed as both:

  • a learning resource
  • a reference implementation
  • a playground for architectural experimentation

Installation

Install the package from PyPI:

pip install pyqt6-scaffold-cookbook

Or install locally from source:

python -m build
pip install dist/*.whl

CLI Usage

After installation, the following command becomes available:

pyqt6-scaffold-cookbook

List all recipes

Running without arguments prints all available examples:

Recipe 01: Database Layer
Recipe 02: First Window
Recipe 03: Navigation
Recipe 04: RBAC UI
Recipe 05: Complete System

View a file from a recipe

You can print any source file directly:

pyqt6-scaffold-cookbook 01_database_layer database

This will output the contents of:

examples/01_database_layer/database.py

Project Structure

Each example is self-contained and follows a consistent structure:

examples/
  01_database_layer/
  02_first_window/
  03_navigation/
  04_rbac_ui/
  05_complete_system/

Each recipe typically includes:

  • README.md – explanation of the concept
  • main.py – entry point (if applicable)
  • windows.py – UI layer
  • database.py – data layer (when relevant)
  • additional modules depending on complexity

Design Philosophy

This project is built around a few core principles:

1. Layered Architecture

UI, business logic, and database access are separated.

2. Declarative UI

UI is described through reusable components instead of imperative construction.

3. Composition over inheritance

Windows and components are composed via a central Composer.

4. Minimal external dependencies

The examples focus on PyQt6 and the scaffold framework itself.

5. Educational clarity

Code is intentionally verbose and heavily documented.


Database Layer

The project uses an abstract database layer:

  • AbstractDatabase defines a unified interface
  • Backends:
    • PostgreSQL
    • MySQL
    • SQLite

Example:

db = PostgresqlDatabase()
db.connect()

with db.execute("SELECT * FROM users") as cursor:
    print(cursor.fetchall())

Authentication & RBAC

Role-based access control is implemented via:

  • Role
  • RoleLevel
  • RBACMixin

Example roles:

  • Guest
  • User
  • Manager
  • Admin

Access to UI components is dynamically controlled based on role level.


Navigation System

Navigation is handled by a central Composer:

  • Registers windows
  • Manages lifecycle
  • Handles navigation events
  • Maintains shared context

Example flow:

LoginWindow -> MainWindow -> Tabs -> CRUD Views

UI Architecture

The UI system is built around:

Cards

Used for list rendering

Delegates

Define how data is displayed visually

Tabs

Encapsulate application features

Forms

Declarative field system for CRUD operations


Important Note

Some examples in this cookbook intentionally simplify or omit production concerns (such as external configuration or full deployment-ready database setup) to focus on architectural clarity and learning value.


Author

Daniel Haus

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqt6_scaffold_cookbook-0.2.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqt6_scaffold_cookbook-0.2.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file pyqt6_scaffold_cookbook-0.2.0.tar.gz.

File metadata

  • Download URL: pyqt6_scaffold_cookbook-0.2.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pyqt6_scaffold_cookbook-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1f3844d7baaca9e76db6fb0b1c73e7ffba7c0f8de4231f827fda81c4cc865429
MD5 07e91eff7d300637839f23de1fe48f4f
BLAKE2b-256 3adfd40ef53db7983dd41550997813467ffc7f1298dcb98734e097f0c64da5d7

See more details on using hashes here.

File details

Details for the file pyqt6_scaffold_cookbook-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt6_scaffold_cookbook-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b9293ea1186aed71064f6060c87b0ce3955937bbc154f671ed90fb9d07fab68
MD5 84c4969d09881069e849224ad889e62c
BLAKE2b-256 0c2df38b6b63c8faac8a44603ed59788f76efd9f48c371a8759d80633be8cb33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page