Skip to content

Commit 5f3bc8b

Browse files
authored
Merge pull request #19 from muziing/dev
Version `0.3.0`
2 parents ea39c09 + f5b3793 commit 5f3bc8b

42 files changed

Lines changed: 3266 additions & 3417 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,6 @@ cython_debug/
139139

140140
# Visual Studio Code Editor
141141
.vscode/
142+
143+
# line-profiler
144+
*.lprof

README.md

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,43 @@ English | <a href="README_zh.md">简体中文</a>
2121

2222
## Introduction
2323

24-
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/).
24+
Py2exe-GUI is an assist tool based on [PySide6](https://doc.qt.io/qtforpython/index.html), designed to provide a
25+
complete yet easy-to-use GUI for [PyInstaller](https://pyinstaller.org/).
2526

26-
![Screenshot of the interface](docs/source/images/Py2exe-GUI_v0.2.0_screenshot.png)
27+
![Screenshot](docs/source/images/Py2exe-GUI_v0.3.0_mainwindow_screenshot.png)
28+
29+
![Screenshot](docs/source/images/Py2exe-GUI_v0.2.0_screenshot.png)
2730

2831
It has the following features:
2932

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

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

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

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

4253
```shell
43-
pip install pyinstaller
54+
pip install pyinstaller # Must be installed in your project environment
4455
```
4556

4657
Then install Py2exe-GUI with `pip`:
4758

4859
```shell
49-
pip install py2exe-gui
60+
pip install py2exe-gui # Can be installed into any environment
5061
```
5162

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

6475
### Option B: Run through source code
6576

66-
Clone repo:
77+
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
78+
source code:
6779

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

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

74-
```shell
75-
poetry init
76-
```
84+
```shell
85+
python -m venv venv # create a virtual environment (Windows)
86+
.\venv\Scripts\activate.ps1 # and activate it (Windows, PowerShell)
87+
```
7788

78-
Install the dependencies:
89+
```shell
90+
python3 -m venv venv # create a virtual environment (Linux/macOS)
91+
source venv/bin/activate # and activate it (Linux/macOS)
92+
```
7993

80-
```shell
81-
poetry install
82-
```
94+
3. Install dependencies and run the program.
8395

84-
Run [Py2exe-GUI.py](src/Py2exe-GUI.py):
96+
```shell
97+
pip install -r requirements.txt
98+
python ./src/Py2exe-GUI.py
99+
```
85100

86-
```shell
87-
cd src
88-
python Py2exe-GUI.py
89-
```
101+
## Contributing
102+
103+
Py2exe-GUI is a free and open source software and anyone is welcome to contribute to its development.
104+
105+
If you encounter any problems while using it (including
106+
bugs, typos, etc.), or if you have suggestions for new features, you can open
107+
an [issue](https://github.com/muziing/Py2exe-GUI/issues/new).
108+
109+
If you are able to contribute code, feel free to submit a pull-request.
110+
Please follow the original code style as much as possible, and make sure that the new code passes all
111+
the [checks](dev_scripts/check_funcs.py).
90112

91113
## License
92114

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

117+
Py2exe-GUI is licensed under the GPLv3 open source license, see the [LICENSE](LICENSE) file for details.
118+
119+
There is one exception: if your project uses Py2exe-GUI only as a packaging tool, and your final distribution does not
120+
contain Py2exe-GUI's source code or binaries, then your project is not restricted by the GPLv3 restrictions and can
121+
still be distributed as closed-source commercial software.
122+
95123
```text
96124
Py2exe-GUI
97-
Copyright (C) 2022-2023 muzing
125+
Copyright (C) 2022-2024 muzing
98126
99127
This program is free software: you can redistribute it and/or modify
100128
it under the terms of the GNU General Public License as published by

README_zh.md

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,36 @@
2020

2121
## 简介
2222

23-
Py2exe-GUI 是一个基于 [PySide6](https://doc.qt.io/qtforpython/index.html) 开发的辅助工具,旨在为 [PyInstaller](https://pyinstaller.org/) 提供完整易用的图形化界面,方便用户进行 Python 项目的打包。
23+
Py2exe-GUI 是一个基于 [PySide6](https://doc.qt.io/qtforpython/index.html)
24+
开发的辅助工具,旨在为 [PyInstaller](https://pyinstaller.org/) 提供完整易用的图形化界面,方便用户进行 Python 项目的打包。
25+
26+
![界面截图](docs/source/images/Py2exe-GUI_v0.3.0_mainwindow_screenshot.png)
2427

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

2730
有如下特性:
2831

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

34-
## 如何使用
37+
## 如何安装
3538

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

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

4245
```shell
43-
pip install pyinstaller
46+
pip install pyinstaller # 必须在你的项目环境中安装
4447
```
4548

4649
然后通过 pip 安装 Py2exe-GUI:
4750

4851
```shell
49-
pip install py2exe-gui
52+
pip install py2exe-gui # 可以安装至任何环境
5053
```
5154

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

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

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

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

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

74-
```shell
75-
poetry init
76-
```
75+
```shell
76+
python -m venv venv # 创建虚拟环境(Windows)
77+
.\venv\Scripts\activate.ps1 # 激活虚拟环境(Windows PowerShell)
78+
```
7779

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

80-
```shell
81-
poetry install
82-
```
85+
3. 安装依赖、运行程序:
8386

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

86-
```shell
87-
cd src
88-
python Py2exe-GUI.py
89-
```
92+
## 贡献
93+
94+
Py2exe-GUI 是一个自由的开源软件,欢迎任何人为其开发贡献力量。
95+
96+
如果你在使用时遇到任何问题(包括
97+
bug、界面错别字等),或者提议新增实用功能,可以提交一个 [issue](https://github.com/muziing/Py2exe-GUI/issues/new)。
98+
99+
如果你有能力有想法贡献代码,欢迎提交 pull
100+
request。请尽可能遵守原有的代码风格,并确保新增代码能通过[静态检查](dev_scripts/check_funcs.py)。
90101

91102
## 开源许可
92103

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

106+
Py2exe-GUI 采用 GPLv3 开源许可证,详情请参见 [LICENSE](LICENSE) 文件。
107+
108+
但有一个例外:如果你的项目仅使用 Py2exe-GUI 作为打包工具,而最终发布的软件中并不包含 Py2exe-GUI 的源码或二进制文件,那么你的项目不会受到
109+
GPLv3 的限制,仍可作为闭源商业软件发布。
110+
95111
```text
96112
Py2exe-GUI
97-
Copyright (C) 2022-2023 muzing
113+
Copyright (C) 2022-2024 Muzing
98114
99115
This program is free software: you can redistribute it and/or modify
100116
it under the terms of the GNU General Public License as published by

dev_scripts/build.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
用于构建项目的脚本
1+
"""用于构建项目的脚本
32
"""
43

54
import subprocess
@@ -21,10 +20,11 @@
2120

2221

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

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

4848

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

@@ -57,17 +57,22 @@ def compile_resources() -> int:
5757
cmd = [
5858
"pyside6-rcc",
5959
"-o",
60-
str(compiled_file_path.resolve()),
61-
str(qrc_file_path.resolve()),
60+
str(compiled_file_path.absolute()),
61+
str(qrc_file_path.absolute()),
6262
]
63-
result = subprocess.run(cmd)
64-
print(f"已完成静态资源文件编译,RCC返回码:{result.returncode}。")
65-
return result.returncode
63+
try:
64+
result = subprocess.run(cmd)
65+
except subprocess.SubprocessError as e:
66+
print(f"RCC编译进程错误:{e}")
67+
raise e
68+
else:
69+
print(f"已完成静态资源文件编译,RCC返回码:{result.returncode}。")
70+
return result.returncode
6671

6772

6873
def export_requirements() -> int:
69-
"""
70-
将项目依赖项导出至 requirements.txt 中
74+
"""将项目依赖项导出至 requirements.txt 中
75+
7176
:return: poetry export 命令返回值
7277
"""
7378

@@ -79,15 +84,19 @@ def export_requirements() -> int:
7984
PROJECT_ROOT / "requirements.txt",
8085
"--format=requirements.txt",
8186
]
82-
result = subprocess.run(poetry_export_cmd)
83-
print(f"已将当前项目依赖导出至 requirements.txt,poetry export 返回码:{result.returncode}")
84-
return result.returncode
87+
88+
try:
89+
result = subprocess.run(poetry_export_cmd)
90+
except subprocess.SubprocessError as e:
91+
print(f"poetry export 进程错误:{e}")
92+
raise e
93+
else:
94+
print(f"已将当前项目依赖导出至 requirements.txt,poetry export 返回码:{result.returncode}")
95+
return result.returncode
8596

8697

8798
def build_py2exe_gui() -> None:
88-
"""
89-
构建项目的总函数 \n
90-
"""
99+
"""构建项目的总函数"""
91100

92101
if check_version_num() + check_license_statement() == 0:
93102
# 准备工作

dev_scripts/clear_cache.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""各种清理函数,如清理 Python 编译缓存、PyInstaller 打包中间文件与输出文件等
2+
"""
3+
14
import os
25
from pathlib import Path
36
from shutil import rmtree

0 commit comments

Comments
 (0)