pyqtrapid is a CLI scaffolding framework and architecture generator for Python desktop applications built with PyQt and PySide.
It streamlines the creation of maintainable, testable, and production-ready GUI applications by establishing architectural separation of concerns, multi-binding abstraction, threading utilities, theme management, component generation, and standard packaging out of the box.
- Multi-Binding Compatibility: Native support for PyQt6, PySide6 (Official Qt for Python 6), and PyQt5.
- Architecture Scaffolds:
- MVP (Model-View-Presenter): Decoupled presentation logic, ideal for enterprise desktop applications.
- MVVM (Model-View-ViewModel): Reactive view-model binding pattern for data-driven UIs.
- Minimal: Lightweight structure for rapid prototyping.
- Component Generators: CLI commands to scaffold individual Views, Models (with unit tests), Dialogs, and Presenters on demand.
- Executable Packaging Scaffolds: Instant setup for PyInstaller (
.spec) and Nuitka C++ standalone executable builds. - Asynchronous Thread Pool: Built-in non-blocking background task runner utilizing
QThreadPoolandQRunnable. - Theme System: Integrated QSS styling engine supporting light/dark theme switching and QSettings persistence.
- Testing & Diagnostics: Pre-configured
pytestsuite and structured logging infrastructure.
Install pyqtrapid using pip:
pip install pyqtrapidTo install from source for development:
git clone https://github.com/edeniyanda/pyqtrapid.git
cd pyqtrapid
pip install -e .Scaffold a complete application directory:
pyqtrapid startproject <project_name> [options]| Option | Short | Default | Description |
|---|---|---|---|
--binding |
-b |
pyqt6 |
Qt Python binding (pyqt6, pyside6, pyqt5) |
--template |
-t |
mvp |
Architectural template (mvp, mvvm, minimal) |
--force |
-f |
false |
Overwrite target directory if it already exists |
Generate modular components inside an existing project:
pyqtrapid generate <type> <name> [options]| Component Type | Description | Output Files |
|---|---|---|
view |
Qt Widget View | src/views/<name>_view.py |
model |
Domain Model & Unit Test | src/models/<name>_model.pytests/test_<name>_model.py |
dialog |
Modal Dialog (QDialog) |
src/views/<name>_dialog.py |
presenter |
Presenter Controller | src/presenters/<name>_presenter.py |
Scaffold production build files for single-file executable bundling:
# Generate PyInstaller build specification
pyqtrapid build-config --tool pyinstaller --name my_app
# Generate Nuitka C++ standalone build script
pyqtrapid build-config --tool nuitka --name my_apppyqtrapid startproject desktop_apppyqtrapid startproject analytics_dashboard --binding pyside6 --template mvvmcd desktop_app
# Generate a User Profile Model with tests
pyqtrapid generate model user_profile
# Generate a Settings View
pyqtrapid generate view settings
# Generate a Custom Login Dialog
pyqtrapid generate dialog loginGenerated projects adhere to clean separation of concerns:
desktop_app/
├── main.py # Application entry point & Qt event loop
├── pyproject.toml # Package metadata & test configuration
├── src/
│ ├── app.py # Dependency injection & view factory
│ ├── core/ # App config, logging, and async worker pool
│ │ ├── config.py
│ │ ├── logger.py
│ │ └── worker.py
│ ├── models/ # Domain state & business logic (pure Python)
│ ├── views/ # Qt Widgets & UI layout definitions
│ ├── presenters/ # Presentation logic connecting Views & Models
│ └── resources/ # Stylesheets (QSS) and static assets
│ └── styles/
│ ├── dark.qss
│ └── light.qss
├── ui/ # Qt Designer (.ui) XML files
└── tests/ # Unit tests and view suite (pytest)
Navigate to your generated project directory and run the application:
cd desktop_app
pip install -e .
python main.pyRun the automated test suite:
pytestContributions, issue reports, and feature suggestions are welcome. Please refer to CONTRIBUTING.md to get started.
pyqtrapid is released under the MIT License.