Skip to content

Commit

Permalink
Merge pull request #19 from muziing/dev
Browse files Browse the repository at this point in the history
Version `0.3.0`
  • Loading branch information
muziing authored Jan 2, 2024
2 parents ea39c09 + f5b3793 commit 5f3bc8b
Show file tree
Hide file tree
Showing 42 changed files with 3,266 additions and 3,417 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ cython_debug/

# Visual Studio Code Editor
.vscode/

# line-profiler
*.lprof
80 changes: 54 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,43 @@ English | <a href="README_zh.md">简体中文</a>

## Introduction

Py2exe-GUI is an assist tool based on [PySide6](https://doc.qt.io/qtforpython/index.html), designed to provide a complete yet easy-to-use GUI for [PyInstaller](https://pyinstaller.org/).
Py2exe-GUI is an assist tool based on [PySide6](https://doc.qt.io/qtforpython/index.html), designed to provide a
complete yet easy-to-use GUI for [PyInstaller](https://pyinstaller.org/).

![Screenshot of the interface](docs/source/images/Py2exe-GUI_v0.2.0_screenshot.png)
![Screenshot](docs/source/images/Py2exe-GUI_v0.3.0_mainwindow_screenshot.png)

![Screenshot](docs/source/images/Py2exe-GUI_v0.2.0_screenshot.png)

It has the following features:

- All options of PyInstaller are supported.
- Call any local Python interpreter with the corresponding environment. No need for repeat installations.(Not realized yet)
- Fully graphical interface, easy to use.
- All options of PyInstaller will be supported.
- You can invoke any local Python interpreter with its corresponding environment, eliminating the need to reinstall it
in each interpreter environment to be packaged.
- Cross-platform, supports Windows, Linux and macOS.

## How to use
> Note: As you can see, I am not an English speaker. Py2exe-GUI is currently only available in Simplified Chinese.
> However, I've reserved some interfaces in the code for internationalization, and the translation is slowly progressing.
> If you are interested in this project, you can star it. In a few months it will provide full English support and
> interfaces for translators to provide translations in more languages.
## How to install

> Note: Py2exe-GUI is still in the early development stage, the way of using it may change frequently, so please check this instruction frequently.
> Note: Py2exe-GUI is still in the early stages of development, and the distributions provided are *beta versions*.
> Installation methods may change frequently, so be sure to check these instructions often.
### Option A: Install with `pip`

First, install PyInstaller in the Python interpreter environment which to be packaged:

```shell
pip install pyinstaller
pip install pyinstaller # Must be installed in your project environment
```

Then install Py2exe-GUI with `pip`:

```shell
pip install py2exe-gui
pip install py2exe-gui # Can be installed into any environment
```

Run:
Expand All @@ -63,38 +74,55 @@ python -m py2exe_gui # `_`, not `-`

### Option B: Run through source code

Clone repo:
For those who like to try it out or are in desperate need of the latest bug fixes, you can run it through the repository
source code:

```shell
git clone https://github.com/muziing/Py2exe-GUI.git
```
1. Download the [latest main branching source code](https://codeload.github.com/muziing/Py2exe-GUI/zip/refs/heads/main).

Install [Poetry](https://python-poetry.org/) and create a virtual environment:
2. Unzip it and go to the directory. Launch a terminal to create and activate the virtual environment:

```shell
poetry init
```
```shell
python -m venv venv # create a virtual environment (Windows)
.\venv\Scripts\activate.ps1 # and activate it (Windows, PowerShell)
```

Install the dependencies:
```shell
python3 -m venv venv # create a virtual environment (Linux/macOS)
source venv/bin/activate # and activate it (Linux/macOS)
```

```shell
poetry install
```
3. Install dependencies and run the program.

Run [Py2exe-GUI.py](src/Py2exe-GUI.py):
```shell
pip install -r requirements.txt
python ./src/Py2exe-GUI.py
```

```shell
cd src
python Py2exe-GUI.py
```
## Contributing

Py2exe-GUI is a free and open source software and anyone is welcome to contribute to its development.

If you encounter any problems while using it (including
bugs, typos, etc.), or if you have suggestions for new features, you can open
an [issue](https://github.com/muziing/Py2exe-GUI/issues/new).

If you are able to contribute code, feel free to submit a pull-request.
Please follow the original code style as much as possible, and make sure that the new code passes all
the [checks](dev_scripts/check_funcs.py).

## License

![GPLv3](docs/source/images/gplv3-127x51.png)

Py2exe-GUI is licensed under the GPLv3 open source license, see the [LICENSE](LICENSE) file for details.

There is one exception: if your project uses Py2exe-GUI only as a packaging tool, and your final distribution does not
contain Py2exe-GUI's source code or binaries, then your project is not restricted by the GPLv3 restrictions and can
still be distributed as closed-source commercial software.
```text
Py2exe-GUI
Copyright (C) 2022-2023 muzing
Copyright (C) 2022-2024 muzing
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
70 changes: 43 additions & 27 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,36 @@

## 简介

Py2exe-GUI 是一个基于 [PySide6](https://doc.qt.io/qtforpython/index.html) 开发的辅助工具,旨在为 [PyInstaller](https://pyinstaller.org/) 提供完整易用的图形化界面,方便用户进行 Python 项目的打包。
Py2exe-GUI 是一个基于 [PySide6](https://doc.qt.io/qtforpython/index.html)
开发的辅助工具,旨在为 [PyInstaller](https://pyinstaller.org/) 提供完整易用的图形化界面,方便用户进行 Python 项目的打包。

![界面截图](docs/source/images/Py2exe-GUI_v0.3.0_mainwindow_screenshot.png)

![界面截图](docs/source/images/Py2exe-GUI_v0.2.0_screenshot.png)

有如下特性:

- 完全图形化界面,易用
- 支持 PyInstaller 的全部选项
- (暂未实现)可以调用本地任一 Python 解释器与对应环境,无需在每个待打包的解释器环境中重复安装
- 跨平台,支持 Windows、Linux、MacOS
- 完全图形化界面,易用
- 将会支持 PyInstaller 的全部选项
- 可以调用本地任一 Python 解释器与对应环境,无需在每个待打包的解释器环境中重复安装
- 跨平台,支持 Windows、Linux、MacOS

## 如何使用
## 如何安装

> 注意:Py2exe-GUI 尚处早期开发阶段,使用方式可能频繁变化,注意经常查阅此使用说明。
> 注意:Py2exe-GUI 尚处早期开发阶段,提供的分发版本均为*beta-测试版*。安装方式也可能频繁变化,注意经常查阅此使用说明。
### 方式1:通过 `pip` 安装

首先在待打包的 Python 解释器环境中安装 PyInstaller:

```shell
pip install pyinstaller
pip install pyinstaller # 必须在你的项目环境中安装
```

然后通过 pip 安装 Py2exe-GUI:

```shell
pip install py2exe-gui
pip install py2exe-gui # 可以安装至任何环境
```

运行
Expand All @@ -63,38 +66,51 @@ python -m py2exe_gui # 注意连字符为_

### 方式2:通过仓库源码运行

克隆仓库
对于喜欢尝鲜或急需最新 bug 修复的用户,可以通过仓库源码运行

```shell
git clone https://github.com/muziing/Py2exe-GUI.git
```
1. 下载[最新 main 分支源码](https://codeload.github.com/muziing/Py2exe-GUI/zip/refs/heads/main)

安装 [Poetry](https://python-poetry.org/) 并创建虚拟环境
2. 解压后进入目录,启动命令行/终端,创建并激活虚拟环境:

```shell
poetry init
```
```shell
python -m venv venv # 创建虚拟环境(Windows)
.\venv\Scripts\activate.ps1 # 激活虚拟环境(Windows PowerShell)
```

安装依赖项:
```shell
python3 -m venv venv # 创建虚拟环境(Linux/macOS)
source venv/bin/activate # 激活虚拟环境(Linux/macOS)
```

```shell
poetry install
```
3. 安装依赖、运行程序:

运行 src 目录下的 [Py2exe-GUI.py](src/Py2exe-GUI.py):
```shell
pip install -r requirements.txt # 安装依赖项
python ./src/Py2exe-GUI.py # 运行
```

```shell
cd src
python Py2exe-GUI.py
```
## 贡献

Py2exe-GUI 是一个自由的开源软件,欢迎任何人为其开发贡献力量。

如果你在使用时遇到任何问题(包括
bug、界面错别字等),或者提议新增实用功能,可以提交一个 [issue](https://github.com/muziing/Py2exe-GUI/issues/new)。

如果你有能力有想法贡献代码,欢迎提交 pull
request。请尽可能遵守原有的代码风格,并确保新增代码能通过[静态检查](dev_scripts/check_funcs.py)。

## 开源许可

![GPLv3](docs/source/images/gplv3-127x51.png)

Py2exe-GUI 采用 GPLv3 开源许可证,详情请参见 [LICENSE](LICENSE) 文件。

但有一个例外:如果你的项目仅使用 Py2exe-GUI 作为打包工具,而最终发布的软件中并不包含 Py2exe-GUI 的源码或二进制文件,那么你的项目不会受到
GPLv3 的限制,仍可作为闭源商业软件发布。

```text
Py2exe-GUI
Copyright (C) 2022-2023 muzing
Copyright (C) 2022-2024 Muzing
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
51 changes: 30 additions & 21 deletions dev_scripts/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
用于构建项目的脚本
"""用于构建项目的脚本
"""

import subprocess
Expand All @@ -21,10 +20,11 @@


def process_md_images(md_file_list: list[Path]) -> None:
"""
处理 Markdown 文档中的图片链接 \n
在构建前替换为 GitHub 图床链接,在构建后替换回本地目录中的路径 \n
:return: 处理方向,0-处置至本地路径,1-处理至GitHub路径
"""处理 Markdown 文档中的图片链接
在构建前替换为 GitHub 图床链接,在构建后替换回本地目录中的路径
:param md_file_list: Markdown 文件列表
"""

md_uri = "docs/source/images/"
Expand All @@ -47,8 +47,8 @@ def process_md_images(md_file_list: list[Path]) -> None:


def compile_resources() -> int:
"""
调用 RCC 工具编译静态资源 \n
"""调用 RCC 工具编译静态资源
:return: rcc 进程返回码
"""

Expand All @@ -57,17 +57,22 @@ def compile_resources() -> int:
cmd = [
"pyside6-rcc",
"-o",
str(compiled_file_path.resolve()),
str(qrc_file_path.resolve()),
str(compiled_file_path.absolute()),
str(qrc_file_path.absolute()),
]
result = subprocess.run(cmd)
print(f"已完成静态资源文件编译,RCC返回码:{result.returncode}。")
return result.returncode
try:
result = subprocess.run(cmd)
except subprocess.SubprocessError as e:
print(f"RCC编译进程错误:{e}")
raise e
else:
print(f"已完成静态资源文件编译,RCC返回码:{result.returncode}。")
return result.returncode


def export_requirements() -> int:
"""
将项目依赖项导出至 requirements.txt 中
"""将项目依赖项导出至 requirements.txt 中
:return: poetry export 命令返回值
"""

Expand All @@ -79,15 +84,19 @@ def export_requirements() -> int:
PROJECT_ROOT / "requirements.txt",
"--format=requirements.txt",
]
result = subprocess.run(poetry_export_cmd)
print(f"已将当前项目依赖导出至 requirements.txt,poetry export 返回码:{result.returncode}")
return result.returncode

try:
result = subprocess.run(poetry_export_cmd)
except subprocess.SubprocessError as e:
print(f"poetry export 进程错误:{e}")
raise e
else:
print(f"已将当前项目依赖导出至 requirements.txt,poetry export 返回码:{result.returncode}")
return result.returncode


def build_py2exe_gui() -> None:
"""
构建项目的总函数 \n
"""
"""构建项目的总函数"""

if check_version_num() + check_license_statement() == 0:
# 准备工作
Expand Down
3 changes: 3 additions & 0 deletions dev_scripts/clear_cache.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""各种清理函数,如清理 Python 编译缓存、PyInstaller 打包中间文件与输出文件等
"""

import os
from pathlib import Path
from shutil import rmtree
Expand Down
Loading

0 comments on commit 5f3bc8b

Please sign in to comment.