chore(backend): 迁移包管理工具从 pip 到 uv
- 新增 pyproject.toml 替代 requirements.txt,合并 pytest.ini 配置 - 添加 greenlet、httpx[socks] 依赖修复运行时错误 - 添加 basedpyright + ruff 开发工具及配置 - 更新 Dockerfile 使用 uv 安装依赖 - 更新 CLAUDE.md 所有后端命令为 uv 前缀 - 删除 requirements.txt 和 pytest.ini Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+6
-4
@@ -1,5 +1,7 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
@@ -8,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy dependency files and install
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-dev --no-install-project
|
||||
|
||||
# Copy application code
|
||||
COPY app/ ./app/
|
||||
@@ -27,4 +29,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# Start application
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user