Skip to content

Commit 316ebd9

Browse files
committed
chore: 移除 requirements.txt,统一使用 pyproject.toml 管理依赖
- 删除 requirements.txt 文件,所有依赖由 pyproject.toml 统一管理 - 更新 Dockerfile/Dockerfile_pi 使用 pip install . 安装依赖 - 更新 Makefile 和 tools/ 下的脚本 - 更新 README.md 和 DEPLOY.md 文档
1 parent e9cefb3 commit 316ebd9

File tree

9 files changed

+16
-33
lines changed

9 files changed

+16
-33
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
77
WORKDIR /app
88

99
# 先只拷贝依赖声明文件,利用 Docker 层缓存
10-
COPY pyproject.toml requirements.txt ./
10+
COPY pyproject.toml ./
1111

1212
# 使用 uv 安装生产依赖到 /app/.venv,离线不污染系统 Python
1313
RUN uv venv .venv && \
1414
uv pip install --python .venv/bin/python \
15-
-r requirements.txt \
15+
. \
1616
--index-url https://pypi.tuna.tsinghua.edu.cn/simple
1717

1818
# ── 运行阶段:精简镜像 ────────────────────────────────────────────────────────

Dockerfile_pi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
44

55
WORKDIR /DicePP
66

7-
COPY ./requirements.txt /DicePP/requirements.txt
7+
COPY ./pyproject.toml /DicePP/pyproject.toml
88

9-
RUN pip install --no-cache-dir --upgrade -r /DicePP/requirements.txt
9+
RUN pip install --no-cache-dir --upgrade .
1010

1111
COPY ./ /DicePP
1212

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
# ── 环境安装 ─────────────────────────────────────────────────────────────────
99
install:
1010
uv venv .venv
11-
uv pip install -r requirements.txt --index-url https://pypi.tuna.tsinghua.edu.cn/simple
11+
uv pip install . --index-url https://pypi.tuna.tsinghua.edu.cn/simple
1212

13-
install-dev: install
13+
install-dev:
14+
uv venv .venv
1415
uv pip install ".[dev]" --index-url https://pypi.tuna.tsinghua.edu.cn/simple
1516

1617
# ── 测试 ─────────────────────────────────────────────────────────────────────

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,27 @@
1919

2020
## 安装
2121

22-
### 使用 pip
22+
### 使用 uv(推荐)
2323

2424
```bash
2525
# 克隆项目
2626
git clone https://github.com/your-repo/nonebot-dicepp.git
2727
cd nonebot-dicepp
2828

2929
# 安装依赖
30-
pip install -r requirements.txt
30+
uv venv .venv
31+
uv pip install .
3132
```
3233

33-
### 使用 uv(推荐)
34+
### 使用 pip
3435

3536
```bash
3637
# 克隆项目
3738
git clone https://github.com/your-repo/nonebot-dicepp.git
3839
cd nonebot-dicepp
3940

4041
# 安装依赖
41-
uv sync
42+
pip install .
4243
```
4344

4445
## 配置

requirements.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

tools/deploy/windows/install_deps.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd /d "%PROJECT_DIR%"
1010
echo ===== 安装 DicePP 依赖 =====
1111
echo.
1212

13-
pip install -r requirements.txt
13+
pip install .
1414

1515
echo.
1616
echo ===== 依赖安装完成 =====

tools/deploy/windows/start_dev.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo.
1212
echo 使用 nb-cli 启动机器人...
1313
echo.
1414

15-
call pip install -r requirements.txt
15+
call pip install .
1616

1717
nb run
1818

tools/dev/install.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ echo [1/2] 创建虚拟环境 .venv ...
77
uv venv .venv
88

99
echo [2/2] 安装依赖(使用清华镜像)...
10-
uv pip install -r requirements.txt --index-url https://pypi.tuna.tsinghua.edu.cn/simple
11-
uv pip install pytest pytest-asyncio pytest-cov --index-url https://pypi.tuna.tsinghua.edu.cn/simple
10+
uv pip install ".[dev]" --index-url https://pypi.tuna.tsinghua.edu.cn/simple
1211

1312
echo.
1413
echo [OK] 安装完成!

tools/docs/DEPLOY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ nonebot-dicepp/
256256
├── bot.py # 主入口
257257
├── Dockerfile # 多阶段构建(uv 安装依赖,精简运行镜像)
258258
├── docker-compose.yml # 容器编排
259-
├── pyproject.toml # 统一依赖声明(uv / pip / poetry 兼容)
260-
├── requirements.txt # 备用依赖列表
259+
├── pyproject.toml # 统一依赖声明(uv / pip 兼容)
261260
├── Makefile # Linux/Mac 快捷命令
262261
├── .env # 环境变量(不提交 Git)
263262
├── src/plugins/DicePP/

0 commit comments

Comments
 (0)