chore(env): manage the virtualenv with uv

- add pyproject.toml and uv.lock pinning teedoc 1.37.9 with the twelve
  plugins listed in site_config.json, plus setuptools: babel's
  babel.messages.frontend imports distutils, which is no longer part of
  the standard library on Python 3.12+
- declare Python >= 3.10, the floor required by the pinned setuptools
- replace the pip preview steps in README.md and share_docs/zh/add_doc.md
  with "uv sync && uv run teedoc serve"; the plugins now come from the
  lockfile, so teedoc install is no longer needed
This commit is contained in:
taorye
2026-09-15 18:00:51 +08:00
parent 3c271420aa
commit 55100ca7e5
4 changed files with 1525 additions and 9 deletions

View File

@@ -19,12 +19,14 @@ More contribute doc :
```bash
git clone https://github.com/sipeed/sipeed_wiki.git
pip install teedoc
cd sipeed_wiki
teedoc install
teedoc serve
uv sync
uv run teedoc serve
```
`uv sync` creates/updates the `.venv` from [`pyproject.toml`](./pyproject.toml) and `uv.lock`, which already includes `teedoc` and all plugins used by this site (so `teedoc install` is not needed).
Install [uv](https://docs.astral.sh/uv/) first if you don't have it.
More build tool usage see [teedoc](http://github.com/teedoc/teedoc)
## For administrator

25
pyproject.toml Normal file
View File

@@ -0,0 +1,25 @@
[project]
name = "sipeed-wiki"
version = "0.1.0"
description = "Sipeed wiki source docs, built with teedoc"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"setuptools==83.0.0",
"teedoc==1.37.9",
"teedoc-plugin-ad-hint==1.1.3",
"teedoc-plugin-assets==1.1.2",
"teedoc-plugin-baidu-tongji==1.0.4",
"teedoc-plugin-blog==1.1.6",
"teedoc-plugin-comments-gitalk==1.5.0",
"teedoc-plugin-google-analytics==1.0.1",
"teedoc-plugin-google-translate==1.1.6",
"teedoc-plugin-jupyter-notebook-parser==1.4.0",
"teedoc-plugin-markdown-parser==2.11.0",
"teedoc-plugin-search==1.5.3",
"teedoc-plugin-theme-default==1.25.0",
"teedoc-plugin-thumbs-up==1.0.2",
]
[tool.uv]
package = false

View File

@@ -46,12 +46,13 @@
```bash
git clone https://github.com/sipeed/sipeed_wiki.git
pip install teedoc
cd sipeed_wiki
teedoc install
teedoc serve
uv sync
uv run teedoc serve
```
`uv sync` 会根据仓库里的 `pyproject.toml` 和 `uv.lock` 创建/更新 `.venv`,其中已经包含 `teedoc` 和本站点用到的所有插件,因此不需要再执行 `teedoc install`。如果本机还没有 uv,先参考 [uv 文档](https://docs.astral.sh/uv/) 安装(例如 `pip install uv` 或官方安装脚本)。
在我们所 Fork 的 Sipeed wiki 的仓库中,点击下图所标注的位置来获得当前仓库的地址。
![copy_forked_url](./assets/copy_forked_url.png)
@@ -60,10 +61,9 @@ teedoc serve
```bash
git clone https://github.com/example/sipeed_wiki.git
pip install teedoc
cd sipeed_wiki
teedoc install
teedoc serve
uv sync
uv run teedoc serve
```
wiki 仓库里面的主要文档存在的文件目录如下:

1489
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff