uv-python-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

uv Python Manager

uv Python 管理器

Goal

目标

Provide a fast and reliable way to manage Python environments and dependencies using the
uv
command-line tool.
提供一种使用
uv
命令行工具快速且可靠地管理Python环境和依赖项的方式。

Instructions

操作说明

  • Interpret the user's request related to Python project setup, dependency management, or execution.
  • Choose the appropriate
    uv
    subcommand (e.g.
    uv venv
    ,
    uv add
    ,
    uv sync
    ,
    uv run
    ).
  • Execute the command via the script in
    scripts/run.sh
    .
  • Clearly explain what the command does before and after execution.
  • Show concise output summaries instead of full logs when possible.
  • 解读用户与Python项目搭建、依赖管理或执行相关的请求。
  • 选择合适的
    uv
    子命令(例如
    uv venv
    uv add
    uv sync
    uv run
    )。
  • 通过
    scripts/run.sh
    中的脚本执行命令。
  • 在执行前后清晰解释该命令的作用。
  • 尽可能展示简洁的输出摘要而非完整日志。

Common Operations

常见操作

  • Create a virtual environment:
    • uv venv
  • Add dependencies:
    • uv add <package>
  • Sync environment from lockfile:
    • uv sync
  • Run a Python script or command:
    • uv run python script.py
  • Manage Python versions:
    • uv python install
    • uv python list
  • 创建虚拟环境:
    • uv venv
  • 添加依赖项:
    • uv add <package>
  • 从锁定文件同步环境:
    • uv sync
  • 运行Python脚本或命令:
    • uv run python script.py
  • 管理Python版本:
    • uv python install
    • uv python list

Constraints

限制条件

  • Do not use
    sudo
    .
  • Do not modify system-wide Python installations.
  • Only operate within the user's current working directory unless explicitly instructed.
  • Do not delete files or environments unless the user explicitly asks.
  • 不要使用
    sudo
  • 不要修改系统级Python安装。
  • 除非明确指示,否则仅在用户当前工作目录内操作。
  • 除非用户明确要求,否则不要删除文件或环境。

Examples

示例

User: Create a new virtual environment for this project
Action:
bash
uv venv
User: Install requests and pandas Action:
bash
uv add requests pandas
User: Run main.py using uv Action:
bash
uv run python main.py
用户: 为这个项目创建一个新的虚拟环境
操作:
bash
uv venv
用户: 安装requests和pandas 操作:
bash
uv add requests pandas
用户: 使用uv运行main.py 操作:
bash
uv run python main.py