Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runesc/ppg
Create Powerful Python Apps with Qt5/Qt6
https://github.com/runesc/ppg
app pyqt5 pyqt6 pyside2 pyside6 qt5 qt6
Last synced: 4 months ago
JSON representation
Create Powerful Python Apps with Qt5/Qt6
- Host: GitHub
- URL: https://github.com/runesc/ppg
- Owner: runesc
- License: gpl-3.0
- Created: 2020-12-22T18:58:16.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T04:39:13.000Z (6 months ago)
- Last Synced: 2024-10-12T01:21:01.587Z (4 months ago)
- Topics: app, pyqt5, pyqt6, pyside2, pyside6, qt5, qt6
- Language: Python
- Homepage:
- Size: 705 KB
- Stars: 34
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PPG - Python Package Generator
Sleek, intuitive, and powerful tool for faster and easier PyQt/PySide App development.
Explore PPG docs »
## Table of contents
- [Install](#install)
- [Status](#status)
- [Changelog](#changelog)
- [Getting started](#getting-started)
- [CLI Usage](#using-the-cli)
- [The Life Cycle of a component](#the-life-cycle-of-a-component)
- [Creators](#creators)
- [Copyright and license](#copyright-and-license)## Install
There ar 3 ways to install PPG:
- [Download the latest release](https://github.com/runesc/PPG/releases/)
- Clone the repo: `git clone https://github.com/runesc/ppg.git`
- Install with PIP: `pip install ppg`Read the [Getting started](#getting-started) section for information, templates, examples, and more.
## Status
![GitHub Release](https://img.shields.io/github/v/release/runesc/PPG?include_prereleases&display_name=release&color=stable&link=https%3A%2F%2Fgithub.com%2Frunesc%2FPPG%2Freleases)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/runesc/PPG?color=%23ab7df8)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-closed/runesc/PPG?color=green)
![GitHub forks](https://img.shields.io/github/forks/runesc/PPG)
![GitHub stars](https://img.shields.io/github/stars/runesc/PPG)
![GitHub licence]( https://img.shields.io/github/license/runesc/PPG)## Changelog
- Added compatibility with PySide6.2+ ✅
- Fixed compatibility issue with PySide2 (PySide6 and Qt5 use `exec()`, while PySide2 uses `exec_()`) ✅
- Fixed an issue that prevented maximizing the window when creating a new project ✅
- Added compatibility with PyInstaller 6.9.0+ ✅
- Fixed an issue where the `QApplication` singleton required destruction before creating a new instance of `QApplication` ✅
- Fixed the `get_resource` method, which previously could not be used normally ✅
- **New!** Added a new feature called Pydux, which manages a global state between components, allowing real-time communication between them 🎉
- Fixed a compilation issue on macOS that prevented applications from compiling correctly due to Sparkle ✅
- Fixed an issue with the CLI in the component/view generator that occurred when the "views" or "components" folder did not exist within the project ✅
- **New!** Components generated by the CLI now natively support Pydux 🎉
- Updated icons ✅## Getting started
This section is a step-by-step overview of using the PPG tool for creating apps.#### Overview
- [Setup](#setup)
- [Create a project](#create-a-project)
- [Running the app](#running-the-app)
- [Compile your app](#compile-your-app)#### Setup
There are many ways to install PPG but before installing it, we recommend creating a virtual environment with virtualenv or conda. We do not recommend installing it directly on your computer to avoid compatibility problems in future projects.##### Using Conda/Miniconda
Run the following command to create your virtual environment:```bash
conda create -n YOUR_ENV_NAME python=3.X -y
```Activate your virtual enviroment.
```bash
conda activate YOUR_ENV_NAME
```##### Using Virtualenv
```bash
python -m venv venv
```Activate your virtual enviroment.
```bash
# On Mac/Linux:
source venv/bin/activate
# On Windows:
call venv\scripts\activate.bat
```##### Installing PPG
Now we need to install PPG.```bash
# Using PIP
pip install ppg# Using github repository
pip install https://github.com/runesc/PPG.git# From source code
curl -L -O https://github.com/runesc/PPG.git
unzip PPG.zip
cd PPG/
python setup.py install
```Great! You already have PPG installed, now you need to choose the Qt binding that you prefer in this case we will use PySide6.
#### Create a project
Creating a project is the easiest part of PPG, you just have to answer a few questions and that's it.```bash
# Just write
ppg init
# Console displays:
PPG init v1.x.xApp name [MyApp] : MyDemoApp
Version [1.0.0] : 1.0.0
Author [ppg] : you
Please select your Qt binding [default: 'PySide6']: 1) PyQt5 or 2) PyQt6 or 3) PySide2 or 4) PySide6 [4] : 4
Mac bundle identifier (eg. com.you.mydemoapp, optional):
Created the src/ directory. If you have PySide6 installed, you can now
do:ppg run
```
#### Running the app
Before running the app, we recommend that you have the qt binding that you will use installed.As you can see, two folders *`src/`* and *`requirements/`* have been created later on we will see in detail what those folders do for now, focus on executing the application
```bash
# Just write
ppg run
```
It's like magic!🎉🌌 You already have a template where you can start expressing your ideas with code.#### Compile your app
We want to turn the source code of our app into a standalone executable that can be run on your users' computers. In the context of Python applications, this process is called "freezing".Use the following command to turn the app's source code into a standalone executable:
```bash
# Just write
ppg freeze
```
This creates the folder *`target/YourApp/`*. You can copy this directory to any other computer (with the same OS as yours) and run the app there.Now we have generated a binary that can run on any PC as long as they use the same operating system (if you compile on Windows you can't run the app on Linux or MacOS) but we need an elegant way to distribute our apps because we can't send the app in zip and ask the user to unzip it and run for that we can choose an installer (*`setup.exe`* on Windows, *`.dmg`* on MacOS or *`.deb/.rpm/.pkg.tar.xz`* on Linux.
To be able to generate an installer you just have to write the following command:
```bash
# Create a installer
ppg installer
```## Using the CLI
PPG CLI is a command line interface tool used to initialize, develop, structure, and maintain Qt applications directly from a command shell.#### Overview
- [ppg init](#ppg-init)
- [ppg start](#ppg-start)
- [ppg create](#ppg-create)
- [ppg freeze](#ppg-freeze)
- [ppg installer](#ppg-installer)
- [ppg test](#ppg-test)
- [ppg clean](#ppg-clean)#### ppg init
Create an Python/Qt workspace.```bash
ppg init
```##### Description
Create and initialize a new Python/Qt application that is the default project for a new workspace.Provides interactive prompts for initial configuration, such as binding to use, version, app name and more. All prompts can be allowed to be safely set by default.
The new workspace folder is named *`src/`* specified and contains configuration files.
By default, the files for a new starter application are placed in the *`src/`* folder.
The configuration of the new application appears in the section of *`build/settings`* where the configuration file of the workspace *`base.json`* is located
#### ppg start
Builds and serves your app.
```bash
ppg start
```#### ppg create
Create a new component or view.```bash
ppg create
```
##### Description
Add a new component to the workspace and configure the project to use it, it can be an empty widget (*`QWidget`*) or a simple component like a *`QPushButton`*.The CLI provides a simple interface where you can select the type of widget you want to work with and the type of component that will be created (*`view`* or *`component`*) and it is saved in its respective folder (*`components/`*/ or *`views/`*/).
##### Arguments
| Argument | Description | Value type |
| :--- | :--- | :--- |
| ``|Select the type of component to be used (**view** or **component**).| `string`|#### ppg freeze
Compile the source code and transform it into an executable file```bash
ppg freeze [options]
```##### Description
Creates an executable file that can be used on any PC that uses the same operating system for which it was compiled.##### Options
| Argument | Description | Value type | Default value |
| :--- | :--- | :--- | :--- |
| `--debug`| It shows a log in the compilation and when executing the app it shows the status in a terminal.| `boolean`|`false`|#### ppg installer
Create a user-friendly installer that can be distributed in a classic way.
```bash
ppg installer
```#### ppg test
Automatically run the unit tests you put in `src/unittest/python`
```bash
ppg test
```
#### ppg clean
Clean up the waste and configuration files that are generated when compiling an application.```bash
ppg clean
```## Creators
**Luis Alfredo Reyes**
-
-## Copyright and license
Code and documentation copyright 2020–2024 the [PPG](#) Code released under the [GPL v3 License](#). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).