chore: add locked requirements
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
|
||||
| 用途 | 命令 |
|
||||
| --- | --- |
|
||||
| 安装依赖 | `pip install websocket-client requests openpyxl pillow PySide6` |
|
||||
| 安装依赖 | `python -m pip install -r requirements.txt` |
|
||||
| 检查 PySide6 | `python -c "import PySide6; print(PySide6.__version__)"` |
|
||||
| 语法检查 | `python -m compileall app main.py` |
|
||||
| 启动 GUI | `python main.py` / `python -m app` |
|
||||
@@ -69,7 +69,9 @@ set AUTO=1 && python prototypes/demo.py
|
||||
|
||||
## 四、依赖纪律
|
||||
|
||||
- 新增第三方依赖前,先在本文说明用途、替代方案和维护成本。
|
||||
- 运行时第三方依赖统一写入根目录 `requirements.txt` 并锁定版本;换机或 CI 使用 `python -m pip install -r requirements.txt` 安装。
|
||||
- 当前直接依赖锁定:PySide6 6.5.3、openpyxl 3.1.3、requests 2.31.0、websocket-client 1.6.1、Pillow 9.5.0。
|
||||
- 新增第三方依赖前,先在本文说明用途、替代方案和维护成本,并同步更新 `requirements.txt`。
|
||||
- GUI 框架固定为 PySide6,不允许混入 Tkinter/PyQt/Web 形成两套 UI。
|
||||
- 不引入第二套浏览器自动化方案(不要 `app/cdp.py` 之外再混入 selenium/playwright)。
|
||||
- 不确定的技术选型先更新本文,再进入代码。
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@
|
||||
|
||||
| ID | 任务 | 依赖 | 验收要点 | 状态 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| T-521 | 依赖清单(锁版本 requirements) | T-006 | 依据 `docs/engineering-review.md` P0。新增锁版本的 `requirements.txt`(或 `pyproject.toml`)声明 PySide6/openpyxl/websocket-client/requests 及版本,与 `docs/03-tech-stack.md` 依赖纪律对齐;README/文档补安装说明;不引入新运行时依赖、不改业务代码 | TODO |
|
||||
| T-521 | 依赖清单(锁版本 requirements) | T-006 | 依据 `docs/engineering-review.md` P0。新增锁版本的 `requirements.txt`(或 `pyproject.toml`)声明 PySide6/openpyxl/websocket-client/requests 及版本,与 `docs/03-tech-stack.md` 依赖纪律对齐;README/文档补安装说明;不引入新运行时依赖、不改业务代码 | DONE |
|
||||
| T-522 | CI:自动跑语法 + 单元/ GUI 测试 | T-006, T-521 | 依据 `docs/engineering-review.md` P1。加 GitHub Actions,在 push/PR 上按 `requirements.txt` 安装依赖并跑 `python -m compileall app main.py` + `python -m unittest discover -s tests`(含 PySide6 环境下的 GUI 测试,`QT_QPA_PLATFORM=offscreen`);不连真实 Shopee/AI;失败即红灯,把"改完必跑测试"变强制门禁 | TODO |
|
||||
| T-523 | 拆分 `app/gui.py` 为 `app/gui/` 包 | T-511, T-514, T-515, T-516, T-517 | 依据 `docs/engineering-review.md` P0。把 6317 行 God-file 拆为包:`models.py`(3 个 TableModel)、`tabs/`(①~⑤各一文件)、`workers.py`(Generate/Apply/Collect/WriteBack/AccountLoginCheck/AIModelTest 从 gui 挪出,与 `app/workers.py` 基类归拢)、`widgets.py`(色板常量、空状态卡、批次总览等 helper)、`main_window.py`。纯结构重构、对外行为与公开符号不变(保留 `from app import gui` 及 `MainWindow`/各 Tab/Worker 的导入路径或提供兼容再导出),保留 PySide6 缺失优雅降级;68 个 GUI 测试全绿、不删减断言 | TODO |
|
||||
| T-524 | PyInstaller 打包为免安装 exe | T-521 | 依据 `docs/engineering-review.md` P1。新增 PyInstaller spec/脚本,产出 Windows 免安装 `.exe`;打包排除并绝不内置 `config.json`/`config/ai_models.json`/`cmshopee.db*`/`chrome_user_data_dir/`/`images/`/`logs/` 等本地数据与密钥;首次运行按现有默认值在本地生成配置;文档补打包与分发步骤 | TODO |
|
||||
|
||||
@@ -26,6 +26,15 @@ cmshopee 是一个给**电商运营**使用的 Windows PySide6 桌面自动化
|
||||
- [界面配色设计](ui-color-design.md):语义色板与组件配色映射规范,指导给状态 / 按钮 / 校验 / 登录状态上色。
|
||||
- [工程评估](engineering-review.md):全栈视角评估工程基础设施与可维护性(依赖清单 / CI / 打包 / gui.py 拆分 / lint),含 P0-P2 与优先级。
|
||||
|
||||
## 运行环境安装
|
||||
|
||||
```powershell
|
||||
python -m pip install -r requirements.txt
|
||||
python -m compileall app main.py
|
||||
python -m unittest discover -s tests
|
||||
```
|
||||
|
||||
`requirements.txt` 只锁定运行所需第三方依赖;`config.json`、`config/ai_models.json`、SQLite、图片、登录态和运营 Excel 仍是本地数据,不提交版本库。
|
||||
## 任务 / 进度 / 当前状态
|
||||
|
||||
- `06-tasks.md` 维护任务看板:任务 ID、依赖、验收要点和状态。
|
||||
|
||||
+10
-5
File diff suppressed because one or more lines are too long
+6
-1
@@ -1020,4 +1020,9 @@
|
||||
- 代码:`app/ai.py` 的 `generate_batch()` 按 `generate_cover` 分支执行;关闭时只生成标题,标题成功即 `db.set_generated(task_id, new_title, None)` 并进入 `generated`,不调用 `gen_cover()`、不渲染封面提示词、不创建新封面文件;开启时保留标题后图片两段流程。
|
||||
- GUI:`app/gui.py` 在②底部增加「生成封面图片(成本较高)」复选框;开始生成前保存当前开关;标题-only 模式进度显示 `图片0/0`,运行日志写明“本轮仅生成标题,不生成图片”,完成统计使用 `generated_done`,避免只看 `cover_done`。
|
||||
- 测试:`tests/test_appconfig.py` 覆盖默认关闭;`tests/test_ai.py` 覆盖跳过封面时不调用 `gen_cover` 且任务进入 generated;`tests/test_gui.py` 覆盖开关持久化、Worker 标题-only 日志/运行日志统计,以及旧图片路径显式开启开关。
|
||||
- 验证:`python -m py_compile app\appconfig.py app\ai.py app\gui.py tests\test_appconfig.py tests\test_ai.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p "test_appconfig.py"` 通过(7 tests);`python -m unittest discover -s tests -p "test_ai.py"` 通过(8 tests);`python -m unittest discover -s tests -p "test_gui.py"` 通过(70 tests);`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(159 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。Qt 仍有本机字体目录提示,不影响测试结果。
|
||||
- 验证:`python -m py_compile app\appconfig.py app\ai.py app\gui.py tests\test_appconfig.py tests\test_ai.py tests\test_gui.py` 通过;`python -m unittest discover -s tests -p "test_appconfig.py"` 通过(7 tests);`python -m unittest discover -s tests -p "test_ai.py"` 通过(8 tests);`python -m unittest discover -s tests -p "test_gui.py"` 通过(70 tests);`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(159 tests);`git diff --check` 无空白错误,仅 LF/CRLF 提示。Qt 仍有本机字体目录提示,不影响测试结果。
|
||||
## 【2026-07-02】T-521 完成 · 依赖清单(锁版本 requirements)
|
||||
|
||||
- 代码/配置:新增根目录 `requirements.txt`,锁定当前直接运行依赖:PySide6==6.5.3、openpyxl==3.1.3、requests==2.31.0、websocket-client==1.6.1、Pillow==9.5.0;不新增运行时依赖,不改业务代码。
|
||||
- 文档:`docs/03-tech-stack.md` 的安装命令改为 `python -m pip install -r requirements.txt`,并补充依赖纪律;`docs/README.md` 增加运行环境安装命令;`docs/06-tasks.md` 标记 T-521 DONE;`docs/current-state.md` 同步当前快照和下一任务 T-522。
|
||||
- 验证:`python -c "import PySide6, openpyxl, requests, websocket, PIL; ..."` 确认当前版本;`python -m pip install --no-index -r requirements.txt` 确认当前环境已满足锁定依赖且不触网;`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(159 tests)。`python -m pip check` 在全局环境发现 albumentations/paddleocr/flask-babel 等非本项目包的既有依赖冲突,非 T-521 新增依赖导致;本项目锁定的 5 个直接依赖可正常 import。
|
||||
@@ -0,0 +1,5 @@
|
||||
PySide6==6.5.3
|
||||
openpyxl==3.1.3
|
||||
requests==2.31.0
|
||||
websocket-client==1.6.1
|
||||
Pillow==9.5.0
|
||||
Reference in New Issue
Block a user