Skip to content

Commit 29a07da

Browse files
authored
Docs: 添加使用 uv tool 方式的安装与使用方法 (#184)
* 📝 add usage for `uv tool` / `uvx` * 📝 add installation guide of uv tool * 📝 add descriptions for specifying python version * 📝 update description about uv tool installation * 📝 update installation
1 parent 0c19ca2 commit 29a07da

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,22 @@ _✨ NoneBot2 命令行工具 ✨_
6868

6969
### 安装
7070

71-
使用 pipx 安装
71+
#### 使用 pipx 安装
7272

7373
```shell
7474
pipx install nb-cli
7575
```
7676

77-
使用 Docker 运行
77+
#### 使用 uv 安装
78+
79+
```shell
80+
uv tool install nb-cli@latest
81+
uv tool update-shell
82+
```
83+
84+
其中 `latest` 可以更改为指定的 CLI 版本
85+
86+
#### 使用 Docker 安装
7887

7988
```shell
8089
docker pull nonebot/nb-cli:latest
@@ -106,7 +115,13 @@ nb --help
106115
- `nb self` 管理 CLI 内部环境
107116
- `nb <script>` 运行脚本
108117

109-
Docker 镜像使用
118+
#### uv tool 使用
119+
120+
```shell
121+
uvx --from nb-cli@latest nb --help
122+
```
123+
124+
#### Docker 镜像使用
110125

111126
```shell
112127
docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest --help
@@ -120,7 +135,15 @@ docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest --help
120135
nb
121136
```
122137

123-
Docker 镜像使用
138+
#### uv tool 使用
139+
140+
```shell
141+
uvx --from nb-cli@latest nb
142+
#
143+
uv tool run --from nb-cli nb
144+
```
145+
146+
#### Docker 镜像使用
124147

125148
```shell
126149
docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest

website/docs/guide/installation.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,34 @@ pipx upgrade nb-cli
3131
```shell title="卸载 NoneBot CLI"
3232
pipx uninstall nb-cli
3333
```
34+
35+
## 通过 uv tool 安装
36+
37+
uv (by Astral) 是一个飞快的 Python 包与项目管理器,使用 Rust 语言编写。其也拥有工具集成管理的功能。
38+
39+
请参考 [uv 文档](https://docs.astral.sh/uv/getting-started/installation/) 来安装 uv。
40+
41+
```shell title="直接运行最新 NoneBot CLI"
42+
uvx --from nb-cli@latest nb
43+
44+
# 指定 Python 版本(如 3.12)
45+
uvx -p 3.12 --from nb-cli@latest nb
46+
```
47+
48+
```shell title="安装 NoneBot CLI"
49+
uv tool install nb-cli@latest
50+
51+
# 指定 Python 版本(如 3.12)
52+
uv tool install -p 3.12 nb-cli@latest
53+
54+
# 更新环境变量允许调用 uv tool 安装的工具
55+
uv tool update-shell
56+
```
57+
58+
```shell title="升级 NoneBot CLI"
59+
uv tool upgrade nb-cli
60+
```
61+
62+
```shell title="卸载 NoneBot CLI"
63+
uv tool uninstall nb-cli
64+
```

0 commit comments

Comments
 (0)