From a4c2078e6e19d5fe6e771c2c4bae5286cafe27cc Mon Sep 17 00:00:00 2001 From: qixinbo Date: Wed, 1 Apr 2026 21:47:49 +0800 Subject: [PATCH] doc: update readme for uv --- README.md | 22 ++++++++++------------ README_en.md | 33 ++++++++++++++------------------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index e84ed65..313e79b 100644 --- a/README.md +++ b/README.md @@ -103,11 +103,11 @@ uv build --wheel --out-dir ../dist ```bash # 建议先创建虚拟环境 -python -m venv .venv +uv venv source .venv/bin/activate # 安装 DataClaw(示例:安装根目录 dist 下的 wheel) -pip install ./dist/dataclaw-*.whl +uv pip install ./dist/dataclaw-*.whl # 启动服务(默认 http://127.0.0.1:8000) dataclaw start @@ -141,14 +141,14 @@ export DATA_ROOT=/absolute/path/to/data ```bash cd backend # 创建虚拟环境(可选但强烈建议) -python -m venv .venv +uv venv source .venv/bin/activate # 安装依赖 -pip install -r requirements.txt +uv sync # 启动 FastAPI 服务器 -uvicorn app.main:app --reload --port 8000 +uv run uvicorn app.main:app --reload --port 8000 ``` ```bash @@ -168,10 +168,10 @@ npm run dev ```bash cd whisper -python -m venv .venv +uv venv source .venv/bin/activate -pip install -r requirements.txt -python main.py +uv pip install -r requirements.txt +uv run python main.py ``` 默认服务地址:`http://localhost:8001` @@ -313,15 +313,13 @@ curl -X POST http://127.0.0.1:8000/api/v1/a2a/tasks//webhooks \ ```bash # 终端1:实例 A cd backend -source .venv/bin/activate -DATA_ROOT=/tmp/dataclaw-a uvicorn main:app --reload --port 8000 +DATA_ROOT=/tmp/dataclaw-a uv run uvicorn main:app --reload --port 8000 ``` ```bash # 终端2:实例 B cd backend -source .venv/bin/activate -DATA_ROOT=/tmp/dataclaw-b uvicorn main:app --reload --port 8001 +DATA_ROOT=/tmp/dataclaw-b uv run uvicorn main:app --reload --port 8001 ``` 然后在两个实例分别注册并登录,拿到 token: diff --git a/README_en.md b/README_en.md index 6f994c7..fa4898b 100644 --- a/README_en.md +++ b/README_en.md @@ -103,27 +103,26 @@ Once built, the wheel is located in the project root `dist/` directory, e.g., `d ```bash # We recommend creating a virtual environment first -python -m venv .venv -source .venv/bin/activate +uv venv # Install DataClaw -pip install ./dist/dataclaw-*.whl +uv pip install ./dist/dataclaw-*.whl # Start the service (defaults to http://127.0.0.1:8000) -dataclaw start +uv run dataclaw start ``` Common service control commands: ```bash # Check running status -dataclaw status +uv run dataclaw status # Custom host/port -dataclaw start --host 0.0.0.0 --port 8000 +uv run dataclaw start --host 0.0.0.0 --port 8000 # Stop the service -dataclaw stop +uv run dataclaw stop ``` Optional environment variable: @@ -141,14 +140,13 @@ If you want to debug the frontend code or rebuild the frontend artifacts, use th ```bash cd backend # Create a virtual environment (optional but recommended) -python -m venv .venv -source .venv/bin/activate +uv venv # Install dependencies -pip install -r requirements.txt +uv sync # Start the FastAPI server -uvicorn app.main:app --reload --port 8000 +uv run uvicorn app.main:app --reload --port 8000 ``` ```bash @@ -168,10 +166,9 @@ If you want to use voice input in chat, run the standalone `whisper` service: ```bash cd whisper -python -m venv .venv -source .venv/bin/activate -pip install -r requirements.txt -python main.py +uv venv +uv pip install -r requirements.txt +uv run python main.py ``` Default service URL: `http://localhost:8001` @@ -264,15 +261,13 @@ Run them in two terminals: ```bash # Terminal 1 - Instance A cd backend -source .venv/bin/activate -DATA_ROOT=/tmp/dataclaw-a uvicorn main:app --reload --port 8000 +DATA_ROOT=/tmp/dataclaw-a uv run uvicorn main:app --reload --port 8000 ``` ```bash # Terminal 2 - Instance B cd backend -source .venv/bin/activate -DATA_ROOT=/tmp/dataclaw-b uvicorn main:app --reload --port 8001 +DATA_ROOT=/tmp/dataclaw-b uv run uvicorn main:app --reload --port 8001 ``` Create/login users and fetch tokens: